## Callin Switzer
## 17 Nov 2017
## Multilevel model to visualize bees'
## behavior on the artificial pollen system

## Update 30 July 2018 -- investigate proportion of time rewarded

#install packages
ipak <- function(pkg){
     new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])]
     if(length(new.pkg)) install.packages(new.pkg, dependencies = TRUE)
     sapply(pkg, require, character.only = TRUE)
}

packages <- c("tidyverse", "reshape2", 'lme4', 'sjPlot', 
              "multcomp",  "effects", "cowplot")
ipak(packages)
## Loading required package: tidyverse
## ── Attaching packages ──────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.0.0     ✔ purrr   0.2.5
## ✔ tibble  1.4.2     ✔ dplyr   0.7.6
## ✔ tidyr   0.8.1     ✔ stringr 1.3.1
## ✔ readr   1.1.1     ✔ forcats 0.3.0
## ── Conflicts ─────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## Loading required package: reshape2
## 
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
## 
##     smiths
## Loading required package: lme4
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following object is masked from 'package:tidyr':
## 
##     expand
## Loading required package: sjPlot
## Learn more about sjPlot with 'browseVignettes("sjPlot")'.
## Loading required package: multcomp
## Loading required package: mvtnorm
## Loading required package: survival
## Loading required package: TH.data
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
## 
##     select
## 
## Attaching package: 'TH.data'
## The following object is masked from 'package:MASS':
## 
##     geyser
## Loading required package: effects
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
## Loading required package: cowplot
## 
## Attaching package: 'cowplot'
## The following objects are masked from 'package:sjPlot':
## 
##     plot_grid, save_plot
## The following object is masked from 'package:ggplot2':
## 
##     ggsave
## tidyverse  reshape2      lme4    sjPlot  multcomp   effects   cowplot 
##      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE      TRUE
# set ggplot theme
theme_set(theme_classic() + theme(axis.text=element_text(colour="black"), text=element_text(size=10)))


# define data and figure directories
{if(windows){
  # windows
  dataDir <- "D:/Dropbox/SonicationBehavior/SonBehData"
  figDir <- "D:/Dropbox/SonicationBehavior/SonBehFigs"
  }
else{
  # mac
  dataDir <- "/Users/cswitzer/Dropbox/SonicationBehavior/SonBehData"
  figDir <- "/Users/cswitzer/Dropbox/SonicationBehavior/SonBehFigs"
}}


# check if the directory exists
file.info(dataDir)$isdir
## [1] TRUE
print(paste("last run ", Sys.time()))
## [1] "last run  2018-10-11 11:14:50"
print(R.version)
##                _                           
## platform       x86_64-apple-darwin15.6.0   
## arch           x86_64                      
## os             darwin15.6.0                
## system         x86_64, darwin15.6.0        
## status                                     
## major          3                           
## minor          5.1                         
## year           2018                        
## month          07                          
## day            02                          
## svn rev        74947                       
## language       R                           
## version.string R version 3.5.1 (2018-07-02)
## nickname       Feather Spray

Read in data and double check it

sl <- read_csv(file.path(dataDir, '01_CombinedTrials_cleaned.csv'))
## Parsed with column specification:
## cols(
##   .default = col_integer(),
##   beeCol = col_character(),
##   meanFreq = col_double(),
##   IT_imputed = col_double(),
##   freq = col_double(),
##   amp = col_double(),
##   datetime = col_character(),
##   rewTF = col_logical(),
##   BeeNumCol = col_character(),
##   accFile = col_character(),
##   datetime_str = col_datetime(format = ""),
##   IT = col_double(),
##   trt = col_character(),
##   amp_acc = col_double()
## )
## See spec(...) for full column specifications.
colnames(sl)
##  [1] "beeCol"       "hive"         "meanFreq"     "IT_imputed"  
##  [5] "index"        "freq"         "amp"          "datetime"    
##  [9] "rewNum"       "rewTF"        "lowRewAmp"    "highrewAmp"  
## [13] "BeeNumCol"    "accFile"      "trialNum"     "datetime_str"
## [17] "lowFrq"       "highFrq"      "IT"           "trt"         
## [21] "amp_acc"
sl <- sl %>%
  # gets rid of the copious warnings
  mutate(timeSinceStart = NA, timeSinceLastBuzz = NA, buzzesSinceReward = NA) %>%
  # make sure all bee colors are lowercase
  mutate(beeCol =  tolower(beeCol)) %>%
  
  # fix orange.5, which should be orange.3
  mutate(hive = ifelse(hive == "5" & beeCol == "orange", "3", hive)) %>%
  # color + hive is an ID var 
  mutate(beeColHive = interaction(beeCol, hive), 
         colNum = paste(beeCol, hive, sep = "_")) %>%
  # remove two trials I messed up
  filter(!(beeCol == "whitepink" & trialNum == 3)) %>%
  filter(!(beeCol == "limepurple" & trialNum == 3)) %>%
  

  # convert hive to factor
  mutate(hive = as.factor(hive),
         trt2  = ifelse(trt == 'full' & trialNum > 1, "full_2", as.character(trt)), 
         trt = relevel(factor(trt), ref = "full")) %>%
  # divide amplitud by 2
  mutate(amp_acc2 = amp_acc / 2) %>%
  mutate(trialNum0 = trialNum - 1)
  


initialFreqAmp <- sl %>%
  dplyr::select(beeColHive, trialNum, freq, amp_acc2) %>%
  filter(trialNum == 1) %>%
  group_by(beeColHive) %>%
  summarize(initialFreq = mean(freq), 
            initialAmp2 = mean(amp_acc2)) %>%
  full_join(sl) %>%
  mutate(ampDiff = amp_acc2 - initialAmp2, 
         freqDiff = freq - initialFreq) %>%
  dplyr::select(beeColHive, trialNum, freqDiff, ampDiff, 
                IT_imputed, rewTF, trt, hive, trt2, 
                freq, amp_acc2, trialNum0, initialFreq, initialAmp2) 
## Joining, by = "beeColHive"
# calculate proportion of rewards by trt
prop.table(xtabs(~ initialFreqAmp$rewTF + initialFreqAmp$trt), margin = 2)
##                     initialFreqAmp$trt
## initialFreqAmp$rewTF      full      high       low
##                FALSE 0.0000000 0.6464258 0.7871369
##                TRUE  1.0000000 0.3535742 0.2128631
xtabs(~ initialFreqAmp$rewTF + initialFreqAmp$trt)
##                     initialFreqAmp$trt
## initialFreqAmp$rewTF full high  low
##                FALSE    0 4205 9999
##                TRUE  4968 2300 2704
# number of trials per bee
sl %>% 
  group_by(beeColHive) %>%
  summarize(count = n()) %>%
  print(n = Inf)
## # A tibble: 42 x 2
##    beeColHive         count
##    <fct>              <int>
##  1 gold.3                54
##  2 orange.3             501
##  3 purple.3               9
##  4 blue.4                36
##  5 goldred.4              3
##  6 green.4               13
##  7 redblue.4            673
##  8 white.4              283
##  9 whitegreen.4          39
## 10 lime.5                28
## 11 limeblue.5           530
## 12 limegold.5            54
## 13 limegreen.5           50
## 14 limeorange.5          84
## 15 limepink.5            51
## 16 limepurple.5         296
## 17 limepurpleyellow.5    58
## 18 limered.5           3474
## 19 limesilver.5           3
## 20 limewhite.5          101
## 21 limeyellow.5          52
## 22 orangeblue.5          50
## 23 orangegreen.5         50
## 24 orangepink.5          50
## 25 orangepurple.5        50
## 26 redgreen.5           530
## 27 redpink.5            677
## 28 redpurple.5          218
## 29 silver.5              26
## 30 whiteblue.5         2786
## 31 whitegold.5         1225
## 32 whiteorange.5       1122
## 33 whitepink.5         1113
## 34 whitepurple.5         55
## 35 whitered.5          1344
## 36 whiteyellow.5        157
## 37 yellowblue.5        1587
## 38 yellowgreen.5        532
## 39 yelloworange.5      2113
## 40 yellowpink.5        2309
## 41 yellowpurple.5      1243
## 42 yellowred.5          547
hist(xtabs(~as.character(sl$beeColHive)))

max(xtabs(~sl$beeCol))
## [1] 3474
mean(xtabs(~sl$beeCol))
## [1] 575.619
sd(xtabs(~sl$beeCol))
## [1] 828.9986
# number of visits for first trial
xtabs(~sl$beeCol[sl$trialNum == 1])
## sl$beeCol[sl$trialNum == 1]
##             blue             gold          goldred            green 
##               36               54                3                9 
##             lime         limeblue         limegold        limegreen 
##               28               50               54               50 
##       limeorange         limepink       limepurple limepurpleyellow 
##               33               51               53               58 
##          limered       limesilver        limewhite       limeyellow 
##               50                3               50               52 
##           orange       orangeblue      orangegreen       orangepink 
##               85               50               50               50 
##     orangepurple           purple          redblue         redgreen 
##               50                9               49               51 
##          redpink        redpurple           silver            white 
##               56               55               26               48 
##        whiteblue        whitegold       whitegreen      whiteorange 
##               56               48               39               54 
##        whitepink      whitepurple         whitered      whiteyellow 
##               64               55               59               55 
##       yellowblue      yellowgreen     yelloworange       yellowpink 
##               54               51               54               58 
##     yellowpurple        yellowred 
##               54               57
hist(xtabs(~sl$beeCol[sl$trialNum == 1]))

mean(xtabs(~sl$beeCol[sl$trialNum == 1]))
## [1] 46.92857
sd(xtabs(~sl$beeCol[sl$trialNum == 1]))
## [1] 16.37725
# number of visits for second trial
xtabs(~sl$beeCol[sl$trialNum == 2])
## sl$beeCol[sl$trialNum == 2]
##        green     limeblue   limeorange   limepurple      limered 
##            4           54           51          243          281 
##    limewhite      redblue     redgreen      redpink    redpurple 
##           51           60           53           58           90 
##        white    whiteblue    whitegold  whiteorange    whitepink 
##           67          314           66          260          143 
##     whitered  whiteyellow   yellowblue  yellowgreen yelloworange 
##          195           47          128           50          176 
##   yellowpink yellowpurple    yellowred 
##          142          346           56
# number of trials per bee and treatment
xtabs(~sl$beeCol +  sl$trt)
##                   sl$trt
## sl$beeCol          full high  low
##   blue               36    0    0
##   gold               54    0    0
##   goldred             3    0    0
##   green              13    0    0
##   lime               28    0    0
##   limeblue          530    0    0
##   limegold           54    0    0
##   limegreen          50    0    0
##   limeorange         84    0    0
##   limepink           51    0    0
##   limepurple         53    0  243
##   limepurpleyellow   58    0    0
##   limered            50    0 3424
##   limesilver          3    0    0
##   limewhite         101    0    0
##   limeyellow         52    0    0
##   orange             85  416    0
##   orangeblue         50    0    0
##   orangegreen        50    0    0
##   orangepink         50    0    0
##   orangepurple       50    0    0
##   purple              9    0    0
##   redblue           673    0    0
##   redgreen          530    0    0
##   redpink            56    0  621
##   redpurple          55  163    0
##   silver             26    0    0
##   white             283    0    0
##   whiteblue          56    0 2730
##   whitegold          48    0 1177
##   whitegreen         39    0    0
##   whiteorange        54    0 1068
##   whitepink          64 1049    0
##   whitepurple        55    0    0
##   whitered           59 1285    0
##   whiteyellow       157    0    0
##   yellowblue         54 1533    0
##   yellowgreen       532    0    0
##   yelloworange       54 2059    0
##   yellowpink         58    0 2251
##   yellowpurple       54    0 1189
##   yellowred         547    0    0
colSums(xtabs(~sl$beeCol +  sl$trt))
##  full  high   low 
##  4968  6505 12703
# total num
sum(colSums(xtabs(~sl$beeCol +  sl$trt)))
## [1] 24176
xtabs(~sl$beeCol +  sl$IT_imputed)
##                   sl$IT_imputed
## sl$beeCol          3.01  3.4 3.48 3.61 3.67 3.74 3.75 3.76 3.82 3.87 3.96
##   blue                0    0    0   36    0    0    0    0    0    0    0
##   gold                0    0    0    0    0    0    0    0    0    0    0
##   goldred             3    0    0    0    0    0    0    0    0    0    0
##   green               0    0    0    0    0    0    0    0    0    0    0
##   lime                0    0    0    0    0    0    0    0    0    0    0
##   limeblue            0    0    0    0    0    0    0    0    0    0    0
##   limegold            0    0    0    0    0    0    0    0    0    0    0
##   limegreen           0    0    0    0    0   50    0    0    0    0    0
##   limeorange          0    0    0    0    0    0    0    0    0    0    0
##   limepink            0    0    0    0    0    0    0    0    0    0    0
##   limepurple          0    0  296    0    0    0    0    0    0    0    0
##   limepurpleyellow    0    0    0    0    0    0   58    0    0    0    0
##   limered             0    0    0    0    0    0    0    0    0    0    0
##   limesilver          0    3    0    0    0    0    0    0    0    0    0
##   limewhite           0    0    0    0    0    0    0  101    0    0    0
##   limeyellow          0    0    0    0   52    0    0    0    0    0    0
##   orange              0    0    0    0    0    0    0    0    0    0    0
##   orangeblue          0    0    0    0    0    0    0    0    0    0    0
##   orangegreen         0    0    0    0    0    0    0    0    0    0    0
##   orangepink          0    0    0    0    0    0    0    0    0    0   50
##   orangepurple        0    0    0    0    0    0    0    0    0    0    0
##   purple              0    0    0    0    0    0    0    0    0    0    0
##   redblue             0    0    0    0    0    0  673    0    0    0    0
##   redgreen            0    0    0    0    0    0    0    0    0    0    0
##   redpink             0    0    0    0    0    0    0    0    0    0    0
##   redpurple           0    0    0    0    0    0    0    0    0    0    0
##   silver              0    0    0    0    0    0    0    0    0    0    0
##   white               0    0    0    0    0    0    0    0    0    0    0
##   whiteblue           0    0    0    0    0    0    0    0    0    0    0
##   whitegold           0    0    0    0    0    0    0    0    0    0    0
##   whitegreen          0    0    0    0    0    0    0    0    0    0    0
##   whiteorange         0    0    0    0    0    0    0    0    0    0    0
##   whitepink           0    0    0    0    0    0    0    0    0    0    0
##   whitepurple         0    0    0    0    0    0    0    0    0    0    0
##   whitered            0    0    0    0    0    0    0    0    0    0    0
##   whiteyellow         0    0    0    0    0    0    0    0    0    0    0
##   yellowblue          0    0    0    0    0    0    0    0    0    0    0
##   yellowgreen         0    0    0    0    0    0    0    0    0    0    0
##   yelloworange        0    0    0    0    0    0    0    0    0    0    0
##   yellowpink          0    0    0    0    0    0    0    0    0 2309    0
##   yellowpurple        0    0    0    0    0    0    0    0 1243    0    0
##   yellowred           0    0    0    0    0    0    0    0    0    0    0
##                   sl$IT_imputed
## sl$beeCol          3.98 3.99    4 4.02 4.03 4.05 4.07 4.12 4.13 4.14 4.15
##   blue                0    0    0    0    0    0    0    0    0    0    0
##   gold                0    0    0    0    0   54    0    0    0    0    0
##   goldred             0    0    0    0    0    0    0    0    0    0    0
##   green               0    0    0    0    0    0    0    0    0    0    0
##   lime                0    0    0   28    0    0    0    0    0    0    0
##   limeblue            0    0    0    0    0    0    0    0    0    0    0
##   limegold            0    0    0    0    0    0    0    0    0    0    0
##   limegreen           0    0    0    0    0    0    0    0    0    0    0
##   limeorange         84    0    0    0    0    0    0    0    0    0    0
##   limepink            0    0    0    0    0    0    0    0   51    0    0
##   limepurple          0    0    0    0    0    0    0    0    0    0    0
##   limepurpleyellow    0    0    0    0    0    0    0    0    0    0    0
##   limered             0    0    0    0    0    0    0    0    0    0 3474
##   limesilver          0    0    0    0    0    0    0    0    0    0    0
##   limewhite           0    0    0    0    0    0    0    0    0    0    0
##   limeyellow          0    0    0    0    0    0    0    0    0    0    0
##   orange              0  501    0    0    0    0    0    0    0    0    0
##   orangeblue          0    0    0    0    0    0    0    0    0    0    0
##   orangegreen         0    0    0    0    0    0    0    0    0    0    0
##   orangepink          0    0    0    0    0    0    0    0    0    0    0
##   orangepurple        0    0    0   50    0    0    0    0    0    0    0
##   purple              0    9    0    0    0    0    0    0    0    0    0
##   redblue             0    0    0    0    0    0    0    0    0    0    0
##   redgreen            0    0    0    0    0    0    0  530    0    0    0
##   redpink             0    0    0    0    0    0    0    0    0    0    0
##   redpurple           0    0    0    0    0    0    0    0    0    0    0
##   silver              0    0    0    0    0    0    0    0    0    0    0
##   white               0    0    0    0  283    0    0    0    0    0    0
##   whiteblue           0    0    0    0    0    0    0    0    0    0    0
##   whitegold           0    0    0    0    0    0    0    0    0    0    0
##   whitegreen          0    0   39    0    0    0    0    0    0    0    0
##   whiteorange         0    0    0    0    0    0    0    0    0    0    0
##   whitepink           0    0    0    0    0    0    0    0    0    0    0
##   whitepurple         0    0    0    0    0    0    0    0    0    0    0
##   whitered            0    0    0    0    0    0    0    0    0    0    0
##   whiteyellow         0    0    0    0    0    0    0    0    0    0    0
##   yellowblue          0    0    0    0    0    0    0    0    0    0    0
##   yellowgreen         0    0    0    0    0    0    0    0    0  532    0
##   yelloworange        0    0    0    0    0    0    0    0    0    0    0
##   yellowpink          0    0    0    0    0    0    0    0    0    0    0
##   yellowpurple        0    0    0    0    0    0    0    0    0    0    0
##   yellowred           0    0    0    0    0    0  547    0    0    0    0
##                   sl$IT_imputed
## sl$beeCol          4.21 4.23 4.24 4.31 4.34 4.37 4.42 4.45 4.46 4.59 4.61
##   blue                0    0    0    0    0    0    0    0    0    0    0
##   gold                0    0    0    0    0    0    0    0    0    0    0
##   goldred             0    0    0    0    0    0    0    0    0    0    0
##   green              13    0    0    0    0    0    0    0    0    0    0
##   lime                0    0    0    0    0    0    0    0    0    0    0
##   limeblue            0    0    0    0    0    0    0    0    0    0    0
##   limegold            0    0    0   54    0    0    0    0    0    0    0
##   limegreen           0    0    0    0    0    0    0    0    0    0    0
##   limeorange          0    0    0    0    0    0    0    0    0    0    0
##   limepink            0    0    0    0    0    0    0    0    0    0    0
##   limepurple          0    0    0    0    0    0    0    0    0    0    0
##   limepurpleyellow    0    0    0    0    0    0    0    0    0    0    0
##   limered             0    0    0    0    0    0    0    0    0    0    0
##   limesilver          0    0    0    0    0    0    0    0    0    0    0
##   limewhite           0    0    0    0    0    0    0    0    0    0    0
##   limeyellow          0    0    0    0    0    0    0    0    0    0    0
##   orange              0    0    0    0    0    0    0    0    0    0    0
##   orangeblue          0    0    0    0    0    0    0    0    0    0   50
##   orangegreen         0    0    0    0    0   50    0    0    0    0    0
##   orangepink          0    0    0    0    0    0    0    0    0    0    0
##   orangepurple        0    0    0    0    0    0    0    0    0    0    0
##   purple              0    0    0    0    0    0    0    0    0    0    0
##   redblue             0    0    0    0    0    0    0    0    0    0    0
##   redgreen            0    0    0    0    0    0    0    0    0    0    0
##   redpink           677    0    0    0    0    0    0    0    0    0    0
##   redpurple           0    0    0    0  218    0    0    0    0    0    0
##   silver              0   26    0    0    0    0    0    0    0    0    0
##   white               0    0    0    0    0    0    0    0    0    0    0
##   whiteblue           0    0    0    0 2786    0    0    0    0    0    0
##   whitegold           0    0    0    0    0    0    0    0    0    0    0
##   whitegreen          0    0    0    0    0    0    0    0    0    0    0
##   whiteorange         0    0    0    0    0    0    0    0 1122    0    0
##   whitepink           0    0    0    0    0    0    0    0    0 1113    0
##   whitepurple         0    0    0    0    0    0    0   55    0    0    0
##   whitered            0    0    0    0    0    0 1344    0    0    0    0
##   whiteyellow         0    0  157    0    0    0    0    0    0    0    0
##   yellowblue          0    0    0    0    0    0    0    0    0    0    0
##   yellowgreen         0    0    0    0    0    0    0    0    0    0    0
##   yelloworange        0    0    0    0 2113    0    0    0    0    0    0
##   yellowpink          0    0    0    0    0    0    0    0    0    0    0
##   yellowpurple        0    0    0    0    0    0    0    0    0    0    0
##   yellowred           0    0    0    0    0    0    0    0    0    0    0
##                   sl$IT_imputed
## sl$beeCol          4.63 4.69 4.94
##   blue                0    0    0
##   gold                0    0    0
##   goldred             0    0    0
##   green               0    0    0
##   lime                0    0    0
##   limeblue            0  530    0
##   limegold            0    0    0
##   limegreen           0    0    0
##   limeorange          0    0    0
##   limepink            0    0    0
##   limepurple          0    0    0
##   limepurpleyellow    0    0    0
##   limered             0    0    0
##   limesilver          0    0    0
##   limewhite           0    0    0
##   limeyellow          0    0    0
##   orange              0    0    0
##   orangeblue          0    0    0
##   orangegreen         0    0    0
##   orangepink          0    0    0
##   orangepurple        0    0    0
##   purple              0    0    0
##   redblue             0    0    0
##   redgreen            0    0    0
##   redpink             0    0    0
##   redpurple           0    0    0
##   silver              0    0    0
##   white               0    0    0
##   whiteblue           0    0    0
##   whitegold        1225    0    0
##   whitegreen          0    0    0
##   whiteorange         0    0    0
##   whitepink           0    0    0
##   whitepurple         0    0    0
##   whitered            0    0    0
##   whiteyellow         0    0    0
##   yellowblue          0    0 1587
##   yellowgreen         0    0    0
##   yelloworange        0    0    0
##   yellowpink          0    0    0
##   yellowpurple        0    0    0
##   yellowred           0    0    0
# hist(unique(sl$IT_imputed[sl$trt2 == "low"]))
# rug(unique(sl$IT_imputed[sl$trt2 == "low"]))
# 
# hist(unique(sl$IT_imputed[sl$trt2 == "high"]))
# rug(unique(sl$IT_imputed[sl$trt2 == "high"]))

# number of trials per bee and treatment
xtabs(~sl$beeCol +  sl$trialNum)
##                   sl$trialNum
## sl$beeCol            1   2   3   4   5   6   7   8   9  10  11  12
##   blue              36   0   0   0   0   0   0   0   0   0   0   0
##   gold              54   0   0   0   0   0   0   0   0   0   0   0
##   goldred            3   0   0   0   0   0   0   0   0   0   0   0
##   green              9   4   0   0   0   0   0   0   0   0   0   0
##   lime              28   0   0   0   0   0   0   0   0   0   0   0
##   limeblue          50  54  50  50  53  55  52  62  53  51   0   0
##   limegold          54   0   0   0   0   0   0   0   0   0   0   0
##   limegreen         50   0   0   0   0   0   0   0   0   0   0   0
##   limeorange        33  51   0   0   0   0   0   0   0   0   0   0
##   limepink          51   0   0   0   0   0   0   0   0   0   0   0
##   limepurple        53 243   0   0   0   0   0   0   0   0   0   0
##   limepurpleyellow  58   0   0   0   0   0   0   0   0   0   0   0
##   limered           50 281 351 298 486 537 393 170  96 105 707   0
##   limesilver         3   0   0   0   0   0   0   0   0   0   0   0
##   limewhite         50  51   0   0   0   0   0   0   0   0   0   0
##   limeyellow        52   0   0   0   0   0   0   0   0   0   0   0
##   orange            85   0  11  88  14  85 137  81   0   0   0   0
##   orangeblue        50   0   0   0   0   0   0   0   0   0   0   0
##   orangegreen       50   0   0   0   0   0   0   0   0   0   0   0
##   orangepink        50   0   0   0   0   0   0   0   0   0   0   0
##   orangepurple      50   0   0   0   0   0   0   0   0   0   0   0
##   purple             9   0   0   0   0   0   0   0   0   0   0   0
##   redblue           49  60  67 131  72  50  60  55  33  49  47   0
##   redgreen          51  53  51  53  51  60  54  54  52  51   0   0
##   redpink           56  58  71  57  62  62  76 119  62  54   0   0
##   redpurple         55  90  73   0   0   0   0   0   0   0   0   0
##   silver            26   0   0   0   0   0   0   0   0   0   0   0
##   white             48  67  46  40  57  25   0   0   0   0   0   0
##   whiteblue         56 314 307 190 539 537 105 103 276 111 248   0
##   whitegold         48  66  76 174 179 198 216 135  64  69   0   0
##   whitegreen        39   0   0   0   0   0   0   0   0   0   0   0
##   whiteorange       54 260 432 376   0   0   0   0   0   0   0   0
##   whitepink         64 143   0  99  78 165 122 127 105 118  92   0
##   whitepurple       55   0   0   0   0   0   0   0   0   0   0   0
##   whitered          59 195 169 278 109  89 112  87 138 108   0   0
##   whiteyellow       55  47  55   0   0   0   0   0   0   0   0   0
##   yellowblue        54 128  92 114 149 116 251 198 167 118 200   0
##   yellowgreen       51  50  56  50  58  52  56  51  54  54   0   0
##   yelloworange      54 176 205 475 113 256 111 141 252 110 220   0
##   yellowpink        58 142 103 140 235 187 278 111 366 266 372  51
##   yellowpurple      54 346 360 330 153   0   0   0   0   0   0   0
##   yellowred         57  56  58  55  51  57  55  56  50  52   0   0
# tabulate num bees in each trt
tdf <- data.frame(xtabs(~sl$beeCol +  sl$trt))
tdf2 <- acast(tdf, sl.beeCol~sl.trt, value.var="Freq")
tdf3 <- as.data.frame(tdf2 > 0)

trtdf<-table(interaction(tdf3$full, tdf3$high, tdf3$low))
names(trtdf) <- c("FULL ONLY", "FULL-HIGH", "FULL-LOW", "NA")
trtdf
## FULL ONLY FULL-HIGH  FULL-LOW        NA 
##        28         6         8         0
# get number of buzzes in each treatment
colSums(tdf2)
##  full  high   low 
##  4968  6505 12703
# get the number of bees for each treatment (every bee has "full" treatment)
apply(tdf2, MARGIN = 2, function(x) length(x[x>0]))
## full high  low 
##   42    6    8
head(sl)
## # A tibble: 6 x 29
##   beeCol hive  meanFreq IT_imputed index  freq    amp datetime rewNum rewTF
##   <chr>  <fct>    <dbl>      <dbl> <int> <dbl>  <dbl> <chr>     <int> <lgl>
## 1 blue   4         395.       3.61     1   400 0.0633 2016_11…      1 TRUE 
## 2 blue   4         395.       3.61     2   360 0.343  2016_11…      2 TRUE 
## 3 blue   4         395.       3.61     3   430 0.441  2016_11…      3 TRUE 
## 4 blue   4         395.       3.61     4   420 0.168  2016_11…      4 TRUE 
## 5 blue   4         395.       3.61     5   420 0.153  2016_11…      5 TRUE 
## 6 blue   4         395.       3.61     6   410 0.183  2016_11…      6 TRUE 
## # ... with 19 more variables: lowRewAmp <int>, highrewAmp <int>,
## #   BeeNumCol <chr>, accFile <chr>, trialNum <int>, datetime_str <dttm>,
## #   lowFrq <int>, highFrq <int>, IT <dbl>, trt <fct>, amp_acc <dbl>,
## #   timeSinceStart <lgl>, timeSinceLastBuzz <lgl>,
## #   buzzesSinceReward <lgl>, beeColHive <fct>, colNum <chr>, trt2 <chr>,
## #   amp_acc2 <dbl>, trialNum0 <dbl>
dim(sl) # should be 24176 rows
## [1] 24176    29
# hive 5 is most common
table(sl$hive, useNA = 'always')
## 
##     3     4     5  <NA> 
##   564  1047 22565     0
# make sure there are values lower than 220 and higher than 450 
# (the cutoff for buzzes used in the experiment)
hist(sl$freq, breaks = seq(215, 450, by = 10))

nrow(sl[sl$freq < 220 | sl$freq > 450,]) # should have 0 rows
## [1] 0
# look at treatments
xtabs(~sl$beeCol+ trt, data = sl )
##                   trt
## sl$beeCol          full high  low
##   blue               36    0    0
##   gold               54    0    0
##   goldred             3    0    0
##   green              13    0    0
##   lime               28    0    0
##   limeblue          530    0    0
##   limegold           54    0    0
##   limegreen          50    0    0
##   limeorange         84    0    0
##   limepink           51    0    0
##   limepurple         53    0  243
##   limepurpleyellow   58    0    0
##   limered            50    0 3424
##   limesilver          3    0    0
##   limewhite         101    0    0
##   limeyellow         52    0    0
##   orange             85  416    0
##   orangeblue         50    0    0
##   orangegreen        50    0    0
##   orangepink         50    0    0
##   orangepurple       50    0    0
##   purple              9    0    0
##   redblue           673    0    0
##   redgreen          530    0    0
##   redpink            56    0  621
##   redpurple          55  163    0
##   silver             26    0    0
##   white             283    0    0
##   whiteblue          56    0 2730
##   whitegold          48    0 1177
##   whitegreen         39    0    0
##   whiteorange        54    0 1068
##   whitepink          64 1049    0
##   whitepurple        55    0    0
##   whitered           59 1285    0
##   whiteyellow       157    0    0
##   yellowblue         54 1533    0
##   yellowgreen       532    0    0
##   yelloworange       54 2059    0
##   yellowpink         58    0 2251
##   yellowpurple       54    0 1189
##   yellowred         547    0    0
# find percentage reward by treatment
mean(grepl("[tT]", as.character(sl$rewTF))) # overall mean
## [1] 0.4124752
# percentage that were rewarded by treatment
tapply((grepl("[tT]", as.character(sl$rewTF))), INDEX= sl$trt, mean)
##      full      high       low 
## 1.0000000 0.3535742 0.2128631
# std dev for rewards by treatment
s2 = sl %>%
  mutate(beeColHive = interaction(beeCol, hive), 
         reward= grepl(pattern = "t", x = .$rewTF, ignore.case = TRUE)*1) 


s3 = s2 %>%
  group_by(beeColHive, trt2) %>%
  dplyr::summarize(mean_reward = mean(reward)) %>%
  group_by(trt2) %>%
  dplyr::arrange(desc(trt2)) 

s3
## # A tibble: 66 x 3
## # Groups:   trt2 [4]
##    beeColHive     trt2  mean_reward
##    <fct>          <chr>       <dbl>
##  1 limepurple.5   low         0.210
##  2 limered.5      low         0.118
##  3 redpink.5      low         0.791
##  4 whiteblue.5    low         0.187
##  5 whitegold.5    low         0.371
##  6 whiteorange.5  low         0.147
##  7 yellowpink.5   low         0.208
##  8 yellowpurple.5 low         0.156
##  9 orange.3       high        0.471
## 10 redpurple.5    high        0.552
## # ... with 56 more rows
# summary for paper
s3 %>%
  dplyr::summarize( mean_ = mean(mean_reward), reward_sd = sd(mean_reward), n = n()) %>%
  mutate(se = reward_sd / sqrt(n))
## # A tibble: 4 x 5
##   trt2   mean_ reward_sd     n     se
##   <chr>  <dbl>     <dbl> <int>  <dbl>
## 1 full   1         0        42 0     
## 2 full_2 1         0        10 0     
## 3 high   0.409     0.105     6 0.0429
## 4 low    0.273     0.223     8 0.0787
# total number of trials for each treatment
tapply((grepl("[tT]", as.character(sl$rewTF))), INDEX= sl$trt, length)
##  full  high   low 
##  4968  6505 12703
# total number of rewards per treatment
tapply((grepl("[tT]", as.character(sl$rewTF))), INDEX= sl$trt, FUN = function(x) sum(x))
## full high  low 
## 4968 2300 2704
# total number of trials that were unrewarded per treatment
tapply((grepl("[tT]", as.character(sl$rewTF))), INDEX= sl$trt, FUN = function(x) sum(!x))
## full high  low 
##    0 4205 9999
# calculate avg freq & SE

se <- function(x) {
  sd(x) /  sqrt(length(x))
}


s4 = s2 %>%
  group_by(beeColHive, trt2) %>%
  dplyr::summarize(mean_freq = mean(freq), 
                   sd_freq = sd(freq)) %>%
  group_by(trt2) %>%
  dplyr::arrange(desc(trt2)) %>%
  filter(trt2 != "full") %>%
  ungroup() %>%
  mutate(trt3 = plyr::mapvalues(.$trt2, from = c("full_2", "high", "low"), 
                        to = c("Full range\n(220 - 450 Hz)", 
                               "High range\n(340 - 390 Hz)", 
                               "Low range\n(220 - 330 Hz)")))




# plot bee size in the groups
sl_sum <- sl %>%
  dplyr::select(beeColHive, trt2, IT_imputed) %>%
  distinct(beeColHive, trt2, .keep_all = TRUE) 

sl_sum %>% print(n = 50)
## # A tibble: 66 x 3
##    beeColHive         trt2   IT_imputed
##    <fct>              <chr>       <dbl>
##  1 blue.4             full         3.61
##  2 gold.3             full         4.05
##  3 goldred.4          full         3.01
##  4 green.4            full         4.21
##  5 green.4            full_2       4.21
##  6 lime.5             full         4.02
##  7 limeblue.5         full_2       4.69
##  8 limeblue.5         full         4.69
##  9 limegold.5         full         4.31
## 10 limegreen.5        full         3.74
## 11 limeorange.5       full_2       3.98
## 12 limeorange.5       full         3.98
## 13 limepink.5         full         4.13
## 14 limepurple.5       low          3.48
## 15 limepurple.5       full         3.48
## 16 limepurpleyellow.5 full         3.75
## 17 limered.5          low          4.15
## 18 limered.5          full         4.15
## 19 limesilver.5       full         3.4 
## 20 limewhite.5        full_2       3.76
## 21 limewhite.5        full         3.76
## 22 limeyellow.5       full         3.67
## 23 orange.3           high         3.99
## 24 orange.3           full         3.99
## 25 orangeblue.5       full         4.61
## 26 orangegreen.5      full         4.37
## 27 orangepink.5       full         3.96
## 28 orangepurple.5     full         4.02
## 29 purple.3           full         3.99
## 30 redblue.4          full_2       3.75
## 31 redblue.4          full         3.75
## 32 redgreen.5         full_2       4.12
## 33 redgreen.5         full         4.12
## 34 redpink.5          low          4.21
## 35 redpink.5          full         4.21
## 36 redpurple.5        full         4.34
## 37 redpurple.5        high         4.34
## 38 silver.5           full         4.23
## 39 white.4            full         4.03
## 40 white.4            full_2       4.03
## 41 whiteblue.5        low          4.34
## 42 whiteblue.5        full         4.34
## 43 whitegold.5        full         4.63
## 44 whitegold.5        low          4.63
## 45 whitegreen.4       full         4   
## 46 whiteorange.5      low          4.46
## 47 whiteorange.5      full         4.46
## 48 whitepink.5        high         4.59
## 49 whitepink.5        full         4.59
## 50 whitepurple.5      full         4.45
## # ... with 16 more rows
sl_sum %>%
  group_by(trt2) %>%
  summarize(counts = n())
## # A tibble: 4 x 2
##   trt2   counts
##   <chr>   <int>
## 1 full       42
## 2 full_2     10
## 3 high        6
## 4 low         8
sl %>% nrow
## [1] 24176
sl %>% group_by(beeColHive) %>%
  summarize(n()) %>%
  nrow()
## [1] 42
print(unique(sl$beeColHive))
##  [1] blue.4             gold.3             goldred.4         
##  [4] green.4            lime.5             limeblue.5        
##  [7] limegold.5         limegreen.5        limeorange.5      
## [10] limepink.5         limepurple.5       limepurpleyellow.5
## [13] limered.5          limesilver.5       limewhite.5       
## [16] limeyellow.5       orange.3           orangeblue.5      
## [19] orangegreen.5      orangepink.5       orangepurple.5    
## [22] purple.3           redblue.4          redgreen.5        
## [25] redpink.5          redpurple.5        silver.5          
## [28] white.4            whiteblue.5        whitegold.5       
## [31] whitegreen.4       whiteorange.5      whitepink.5       
## [34] whitepurple.5      whitered.5         whiteyellow.5     
## [37] yellowblue.5       yellowgreen.5      yelloworange.5    
## [40] yellowpink.5       yellowpurple.5     yellowred.5       
## 126 Levels: blue.3 gold.3 goldred.3 green.3 lime.3 ... yellowred.5
print(unique(sl$beeCol))
##  [1] "blue"             "gold"             "goldred"         
##  [4] "green"            "lime"             "limeblue"        
##  [7] "limegold"         "limegreen"        "limeorange"      
## [10] "limepink"         "limepurple"       "limepurpleyellow"
## [13] "limered"          "limesilver"       "limewhite"       
## [16] "limeyellow"       "orange"           "orangeblue"      
## [19] "orangegreen"      "orangepink"       "orangepurple"    
## [22] "purple"           "redblue"          "redgreen"        
## [25] "redpink"          "redpurple"        "silver"          
## [28] "white"            "whiteblue"        "whitegold"       
## [31] "whitegreen"       "whiteorange"      "whitepink"       
## [34] "whitepurple"      "whitered"         "whiteyellow"     
## [37] "yellowblue"       "yellowgreen"      "yelloworange"    
## [40] "yellowpink"       "yellowpurple"     "yellowred"
sl %>% group_by(trt2) %>%
  summarize(count= n())
## # A tibble: 4 x 2
##   trt2   count
##   <chr>  <int>
## 1 full    1971
## 2 full_2  2997
## 3 high    6505
## 4 low    12703
sl_sum %>% group_by(trt2) %>%
  summarize(count= n())
## # A tibble: 4 x 2
##   trt2   count
##   <chr>  <int>
## 1 full      42
## 2 full_2    10
## 3 high       6
## 4 low        8
s2 <- sl_sum  %>%
  filter(trt2 != "full")

s2 <- s2 %>%
  mutate(trt3 = plyr::mapvalues(.$trt2, from = c("full_2", "high", "low"), 
                        to = c("Full range\n(220 - 450 Hz)", 
                               "High range\n(340 - 390 Hz)", 
                               "Low range\n(220 - 330 Hz)")))

s44 <- full_join(s2, s4)
## Joining, by = c("beeColHive", "trt2", "trt3")
s44
## # A tibble: 24 x 6
##    beeColHive   trt2   IT_imputed trt3                   mean_freq sd_freq
##    <fct>        <chr>       <dbl> <chr>                      <dbl>   <dbl>
##  1 green.4      full_2       4.21 "Full range\n(220 - 4…      285     59.2
##  2 limeblue.5   full_2       4.69 "Full range\n(220 - 4…      304.    40.1
##  3 limeorange.5 full_2       3.98 "Full range\n(220 - 4…      345.    26.7
##  4 limepurple.5 low          3.48 "Low range\n(220 - 33…      344.    32.6
##  5 limered.5    low          4.15 "Low range\n(220 - 33…      365.    37.1
##  6 limewhite.5  full_2       3.76 "Full range\n(220 - 4…      327.    35.5
##  7 orange.3     high         3.99 "High range\n(340 - 3…      382.    27.5
##  8 redblue.4    full_2       3.75 "Full range\n(220 - 4…      341.    43.3
##  9 redgreen.5   full_2       4.12 "Full range\n(220 - 4…      326.    36.4
## 10 redpink.5    low          4.21 "Low range\n(220 - 33…      290.    39.1
## # ... with 14 more rows
set.seed(123)
ggplot(s44, aes(x = trt3,  y= IT_imputed)) + 
  geom_violin(width = 0.5, fill = "grey90", color = NA, bw = 0.2, trim = TRUE) + 
  #geom_boxplot(width = 0.5, outlier.alpha =   0) + 
  geom_point(position = position_jitter(height = 0, width = 0.05), 
             stroke= 0, size = 2.5, color = 'grey40') + 
  labs(x = "Frequency range for reward", y = "Intertegular span (mm)") 

ggsave(file.path(figDir, "beeSize_exp1.png"), width = 6, height = 4, units = "in", dpi = 500)
ggsave(file.path(figDir, "beeSize_exp1.svg"), width = 6, height = 4, units = "in")


# plot freq vs. amp
sl <- sl %>%
  mutate(`IT interval (mm)` = cut_interval(IT_imputed, n = 3))

ggp <- ggplot(sl[sl$trt2 == "full", ], aes(x = freq, y = amp_acc2)) + 
  geom_point(position = position_jitter(height = 0, width = 2), 
             alpha = 0.3, stroke = 0, size = 1.5) + 
  stat_smooth(method = 'loess', span = 1, color = 'grey40', se = FALSE, 
              lwd = 1.3) + 
  facet_wrap(~`IT interval (mm)`, labeller = "label_both") + 
  theme(strip.background = element_blank(), 
        strip.text = element_text(size = 10)) + 
  theme(legend.position = "none", 
        plot.margin = unit(c(1,1,1,1)/2, "cm")) + 
  labs(x = "Sonication Frequency (Hz)", y = expression ("Sonication acceleration "(m~s^{-2})))

ggp

ggsave(file.path(figDir, "freq_amp.png"), width = 6.5, height = 3, units = "in", dpi = 500)

svg(file.path(figDir, "freq_amp.svg"), width = 6.5, height = 3)
ggp
dev.off()
## quartz_off_screen 
##                 2

MODELING

# summary for paper
# fit a varying slope and intercept for colNum (bee ID), and allow the slope of the trialNum
# variable to vary by colNum (beeID)
# basically the same model
sl$trialNum
##     [1]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##    [23]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##    [45]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##    [67]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##    [89]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  2  2  2  2  1  1  1  1
##   [111]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [133]  1  1  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##   [155]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##   [177]  5  5  5  5  5  5  5  5  5  5  5 10 10 10 10 10 10 10 10 10 10 10
##   [199] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##   [221] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10  1  1  1  1
##   [243]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [265]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [287]  1  1  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##   [309]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##   [331]  4  4  4  4  4  4  4  4  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##   [353]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##   [375]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##   [397]  8  8  8  8  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##   [419]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##   [441]  3  3  3  3  3  3  3  3  3  3  7  7  7  7  7  7  7  7  7  7  7  7
##   [463]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##   [485]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  2  2  2  2
##   [507]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [529]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [551]  2  2  2  2  2  2  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##   [573]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##   [595]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  6  6  6  6  6  6  6
##   [617]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##   [639]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##   [661]  6  6  6  6  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [683]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [705]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [727]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [749]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  2  2
##   [771]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [793]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [815]  2  2  2  2  2  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [837]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [859]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [881]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##   [903]  1  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [925]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [947]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [969]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##   [991]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1013]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1035]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1057]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1079]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1101]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1123]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [1145]  2  2  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [1167]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [1189]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [1211]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [1233]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [1255]  1  1  1 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1277] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1299] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1321] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1343] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1365] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1387] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1409] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1431] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1453] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1475] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1497] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1519] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1541] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1563] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1585] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1607] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1629] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1651] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1673] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1695] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1717] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1739] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1761] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1783] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1805] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1827] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1849] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1871] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1893] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1915] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1937] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [1959] 11 11 11 11 11 11  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [1981]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [2003]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [2025]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [2047]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  5  5  5  5  5  5  5  5
##  [2069]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2091]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2113]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2135]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2157]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2179]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2201]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2223]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2245]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2267]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2289]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2311]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2333]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2355]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2377]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2399]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2421]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2443]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2465]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2487]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2509]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [2531]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  6  6  6  6  6  6
##  [2553]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2575]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2597]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2619]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2641]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2663]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2685]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2707]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2729]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2751]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2773]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2795]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2817]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2839]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2861]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2883]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2905]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2927]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2949]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2971]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [2993]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [3015]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [3037]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [3059]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [3081]  6  6  6  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3103]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3125]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3147]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3169]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3191]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3213]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3235]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3257]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3279]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3301]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3323]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [3345]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  1  1
##  [3367]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [3389]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [3411]  1  1  1  1  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3433]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3455]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3477]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3499]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3521]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3543]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3565]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3587]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3609]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3631]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3653]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3675]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [3697]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4 10 10 10 10 10 10
##  [3719] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [3741] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [3763] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [3785] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [3807] 10 10 10 10 10 10 10 10 10 10 10  8  8  8  8  8  8  8  8  8  8  8
##  [3829]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3851]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3873]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3895]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3917]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3939]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3961]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [3983]  8  8  8  8  8  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4005]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4027]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4049]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4071]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4093]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4115]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4137]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4159]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4181]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4203]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4225]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4247]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4269]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4291]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4313]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [4335]  3  3  3  3  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4357]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4379]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4401]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4423]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4445]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4467]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4489]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4511]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4533]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4555]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4577]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4599]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4621]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4643]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4665]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4687]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4709]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [4731]  7  1  1  1  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [4753]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [4775]  2  2  2  2  2  2  2  2  2  2  2  1  1  1  1  1  1  1  1  1  1  1
##  [4797]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [4819]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [4841]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [4863]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [4885]  1  1  1  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [4907]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [4929]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [4951]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  6  6  6  6
##  [4973]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [4995]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [5017]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [5039]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  5  5  5  5  5  5  5
##  [5061]  5  5  5  5  5  5  5  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5083]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5105]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5127]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5149]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5171]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5193]  7  7  7  7  7  7  7  7  7  7  7  7  3  3  3  3  3  3  3  3  3  3
##  [5215]  3  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5237]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5259]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5281]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5303]  4  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5325]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5347]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5369]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5391]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5413]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5435]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5457]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5479]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5501]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5523]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5545]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5567]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5589]  1  1  1  1  1  1  1  1  1  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [5611]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [5633]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  1  1  1  1  1  1  1
##  [5655]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [5677]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  9  9
##  [5699]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [5721]  9  9  9  9  9  9  9  9  9  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5743]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5765]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5787]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5809]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5831]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [5853]  4  4  4  4  4  4  4  4  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5875]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5897]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [5919]  7  7  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [5941]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [5963]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [5985]  5  5  5  5  5  5  5  5  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6007]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6029]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  3  3  3
##  [6051]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [6073]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [6095]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3 10 10
##  [6117] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [6139] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [6161] 10 10 10 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [6183] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [6205] 11 11 11 11 11 11  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6227]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6249]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6271]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [6293]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [6315]  5  5  5  5  5  5  5  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [6337]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [6359]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  1  1  1  1  1  1
##  [6381]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [6403]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [6425]  1  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6447]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6469]  2  2  2  2  2  2  2  2  2  2  9  9  9  9  9  9  9  9  9  9  9  9
##  [6491]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [6513]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  6  6  6  6
##  [6535]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [6557]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [6579]  6  6  6  6  6  6  6  6  6  6  6  6  8  8  8  8  8  8  8  8  8  8
##  [6601]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6623]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6645] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [6667] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [6689] 10 10 10 10 10 10 10  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [6711]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [6733]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  7  7  7  7  7  7  7  7
##  [6755]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [6777]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [6799]  7  7  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6821]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [6843]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 10 10 10 10 10 10
##  [6865] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [6887] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
##  [6909] 10 10 10 10  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6931]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6953]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6975]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [6997]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [7019]  8  8  8  8  8  8  8  8  8  8  8  8  8  7  7  7  7  7  7  7  7  7
##  [7041]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [7063]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [7085]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [7107]  7  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [7129]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [7151]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  3  3  3
##  [7173]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7195]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7217]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7239]  3  3  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7261]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7283]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  4  4  4  4  4  4  4  4
##  [7305]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [7327]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [7349]  4  4  4  4  4  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [7371]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [7393]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [7415]  6  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [7437]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
##  [7459]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  1  1  1
##  [7481]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7503]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7525]  1  1  1  1  1  1  1  1  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [7547]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [7569]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [7591]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [7613]  2  2  2  2  2  2  2  2  2  2  3  3  3  3  3  3  3  3  3  3  3  3
##  [7635]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7657]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7679]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  1  1  1  1  1
##  [7701]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7723]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7745]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [7767]  1  1  1  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [7789]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  6
##  [7811]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [7833]  6  6  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7855]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [7877]  3  3  3  3  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [7899]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [7921]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  2  2  2  2  2
##  [7943]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [7965]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
##  [7987]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  7  7  7  7
##  [8009]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [8031]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [8053]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [8075]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
##  [8097]  7  7  7  7  7  7  7  7  7  7  7  7  7  3  3  3  3  3  3  3  3  3
##  [8119]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8141]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8163]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8185]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8207]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8229]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8251]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8273]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8295]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8317]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8339]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8361]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8383]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
##  [8405]  3  3  3  3  3  3  3  3  3  3  3  3  4  4  4  4  4  4  4  4  4  4
##  [8427]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8449]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8471]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8493]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8515]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8537]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8559]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8581]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
##  [8603]  4  4  4  4  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [8625]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
##  [8647]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  8  8  8  8  8  8
##  [8669]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [8691]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [8713]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [8735]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
##  [8757]  8  8  8  8  8  8  8  8  8 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8779] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8801] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8823] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8845] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8867] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8889] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8911] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8933] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8955] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8977] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
##  [8999] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11  6  6  6  6  6  6  6
##  [9021]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9043]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9065]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9087]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9109]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9131]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9153]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9175]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9197]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9219]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9241]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9263]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9285]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9307]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9329]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9351]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9373]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9395]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9417]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9439]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9461]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9483]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9505]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9527]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
##  [9549]  6  6  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9571]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9593]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9615]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9637]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9659]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9681]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9703]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9725]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9747]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9769]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9791]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9813]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9835]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9857]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9879]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9901]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9923]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9945]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9967]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
##  [9989]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [10011]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [10033]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [10055]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [10077]  5  5  5  5  5  5  5  5  5  5  5  5  5  9  9  9  9  9  9  9  9  9
## [10099]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10121]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10143]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10165]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10187]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10209]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10231]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10253]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10275]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10297]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10319]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10341]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [10363]  9  9  9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [10385] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [10407] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [10429] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [10451] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [10473] 10 10 10 10  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10495]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10517]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10539]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10561]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10583]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10605]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10627]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10649]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10671]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10693]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10715]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10737]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10759]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [10781]  2  2  2  2  2  2  2  2  2  2  1  1  1  1  1  1  1  1  1  1  1  1
## [10803]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [10825]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  6  6  6  6  6  6  6  6
## [10847]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [10869]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [10891]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [10913]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [10935]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [10957]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [10979]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [11001]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [11023]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  9  9  9  9  9  9  9  9
## [11045]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [11067]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [11089]  9  9  9  9  9  9  9  9  9  9  9  9  5  5  5  5  5  5  5  5  5  5
## [11111]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11133]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11155]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11177]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11199]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11221]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11243]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [11265]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  7  7  7  7  7  7  7
## [11287]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11309]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11331]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11353]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11375]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11397]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11419]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11441]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11463]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [11485]  7  7  7  7  7  7  7  7  7  7  7  4  4  4  4  4  4  4  4  4  4  4
## [11507]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11529]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11551]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11573]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11595]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11617]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11639]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [11661]  4  4  4  4  4  4  4  4  4  3  3  3  3  3  3  3  3  3  3  3  3  3
## [11683]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [11705]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [11727]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3 10 10 10
## [11749] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [11771] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [11793] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [11815]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [11837]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [11859]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [11881]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [11903]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [11925]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [11947]  8  8  8  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [11969]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [11991]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12013]  2  2  2  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [12035]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  2  2
## [12057]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12079]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12101]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12123]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12145]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12167]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12189]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12211]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12233]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12255]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12277]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [12299]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  1  1  1  1  1  1
## [12321]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [12343]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [12365]  1  1  1  1  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12387]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12409]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12431]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12453]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12475]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12497]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12519]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12541]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12563]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12585]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12607]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12629]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12651]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12673]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12695]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12717]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12739]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12761]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [12783]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  4  4  4  4
## [12805]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12827]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12849]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12871]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12893]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12915]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12937]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12959]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [12981]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13003]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13025]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13047]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13069]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13091]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13113]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13135]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13157]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  6  6
## [13179]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13201]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13223]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13245]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13267]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13289]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13311]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [13333]  6  6  6  6  6  6  6  6  6  2  2  2  2  2  2  2  2  2  2  2  2  2
## [13355]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [13377]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [13399]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [13421]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [13443]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [13465]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 10 10
## [13487] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [13509] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [13531] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [13553] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [13575] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [13597] 10 10 10 10 10 10  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [13619]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [13641]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [13663]  1  1  1  1  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [13685]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [13707]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [13729]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [13751]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [13773]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  4  4  4  4  4  4
## [13795]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13817]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13839]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13861]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [13883]  4  4  4  4  4  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [13905]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [13927]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [13949]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [13971]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [13993] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [14015] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [14037] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [14059] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [14081] 11 11 11 11  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14103]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14125]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14147]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14169]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14191]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  5
## [14213]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14235]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14257]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14279]  5  5  5  5  5  5  5  5  5  5  5  1  1  1  1  1  1  1  1  1  1  1
## [14301]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [14323]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [14345]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14367]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14389]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [14411]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  5
## [14433]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14455]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14477]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14499]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [14521]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  9  9
## [14543]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [14565]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [14587]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [14609]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [14631]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [14653]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [14675]  9  9  9  9  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [14697]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [14719]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  4  4  4
## [14741]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14763]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14785]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14807]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14829]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14851]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14873]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14895]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14917]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14939]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14961]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [14983]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [15005]  4  4  4  4  4  4  4  4  4  4  4 10 10 10 10 10 10 10 10 10 10 10
## [15027] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15049] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15071] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15093] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15115] 10 10 10 10 10 10 10 10 10  6  6  6  6  6  6  6  6  6  6  6  6  6
## [15137]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [15159]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [15181]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [15203]  6  6  6  6  6  6  6  6  6  6  7  7  7  7  7  7  7  7  7  7  7  7
## [15225]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [15247]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [15269]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [15291]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [15313]  7  7  7  7  7  7  7  7  7  7  7  7  3  3  3  3  3  3  3  3  3  3
## [15335]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15357]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15379]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15401]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15423]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15445]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15467]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15489]  3  3  3  3  3  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15511]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15533]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15555]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15577]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15599]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15621]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15643]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15665]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15687]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15709]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [15731]  2  2  2  2  2  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [15753]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [15775]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  3  3  3  3  3  3
## [15797]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15819]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [15841]  3  3  3  3  3 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15863] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15885] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15907] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15929] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [15951] 10 10 10 10 10 10 10 10 10 10 10 10 10  6  6  6  6  6  6  6  6  6
## [15973]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [15995]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [16017]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [16039]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [16061]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  8  8  8
## [16083]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16105]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16127]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16149]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16171]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16193]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16215]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16237]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [16259]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  4  4  4
## [16281]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [16303]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [16325]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [16347]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [16369]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [16391]  4  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16413]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16435]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16457]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16479]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16501]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16523]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [16545]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  2  2  2  2  2  2  2  2
## [16567]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [16589]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [16611]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [16633]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [16655]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [16677]  2  2  2  2  2  2  2  2  2  2  5  5  5  5  5  5  5  5  5  5  5  5
## [16699]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [16721]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [16743]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [16765]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [16787]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [16809]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [16831]  5  5  5  5  5  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16853]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16875]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16897]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16919]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16941]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16963]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [16985]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [17007]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [17029]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [17051]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [17073]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  1  1  1  1  1  1  1  1
## [17095]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [17117]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [17139]  1  1  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [17161]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [17183]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [17205]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [17227]  3  3  3  3  3  3 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17249] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17271] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17293] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17315] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17337] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17359] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17381] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17403] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [17425] 11 11 11 11 11 11 11 11  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [17447]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [17469]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  6  6  6  6  6  6  6  6
## [17491]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [17513]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [17535] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [17557] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [17579] 10 10 10 10 10 10 10 10 10 10  4  4  4  4  4  4  4  4  4  4  4  4
## [17601]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [17623]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  7  7  7  7  7  7
## [17645]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [17667]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [17689]  7  7  7  7  7  7  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [17711]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [17733]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  3  3
## [17755]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [17777]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [17799]  3  3  3  3  3  3  3  3  3  3  8  8  8  8  8  8  8  8  8  8  8  8
## [17821]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [17843]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  1  1  1  1  1
## [17865]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [17887]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [17909]  1  1  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [17931]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [17953]  9  9  9  9  9  9  9  9  9  9  9  9  1  1  1  1  1  1  1  1  1  1
## [17975]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [17997]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [18019] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [18041] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [18063] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [18085] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [18107] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [18129]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18151]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18173]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18195]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18217]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18239]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18261]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18283]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18305]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18327]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18349]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [18371]  9  9  9  9  9  9  9  9  9  9  8  8  8  8  8  8  8  8  8  8  8  8
## [18393]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [18415]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [18437]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [18459]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [18481]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [18503]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8 11 11 11
## [18525] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18547] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18569] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18591] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18613] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18635] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18657] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18679] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18701] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [18723] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11  6  6  6
## [18745]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18767]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18789]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18811]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18833]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18855]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18877]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18899]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18921]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18943]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18965]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [18987]  6  6  6  6  6  6  6  6  6  6  6  3  3  3  3  3  3  3  3  3  3  3
## [19009]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19031]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19053]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19075]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19097]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19119]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19141]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19163]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [19185]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  5  5  5  5
## [19207]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [19229]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [19251]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [19273]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [19295]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  4
## [19317]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19339]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19361]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19383]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19405]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19427]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19449]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19471]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19493]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19515]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19537]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19559]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19581]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19603]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19625]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19647]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19669]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19691]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19713]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19735]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19757]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [19779]  4  4  4  4  4  4  4  4  4  4  4  4  2  2  2  2  2  2  2  2  2  2
## [19801]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19823]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19845]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19867]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19889]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19911]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19933]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [19955]  2  2  2  2  2  2  2  2  2  2  2  2  7  7  7  7  7  7  7  7  7  7
## [19977]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [19999]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20021]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20043]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20065]  7  7  7  7  7  7  7  7  7  7  7  7  7  8  8  8  8  8  8  8  8  8
## [20087]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [20109]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [20131]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [20153]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [20175]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  7  7  7  7  7  7  7  7
## [20197]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20219]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20241]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20263]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20285]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20307]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20329]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20351]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20373]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20395]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20417]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20439]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [20461]  7  7  7  7  7  7  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [20483]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [20505]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [20527]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [20549]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [20571]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [20593]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2 10 10 10 10 10 10
## [20615] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20637] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20659] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20681] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20703] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20725] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20747] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20769] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20791] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20813] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20835] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [20857] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10  4  4  4  4
## [20879]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [20901]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [20923]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [20945]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [20967]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [20989]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [21011]  4  4  4  4 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21033] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21055] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21077] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21099] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21121] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21143] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21165] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21187] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21209] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21231] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21253] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21275] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21297] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21319] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21341] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21363] 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11
## [21385] 11 11  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21407]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21429]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21451]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21473]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21495]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21517]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21539]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [21561]  6  6  6  6  6  6  6  6  6  6  6  6  6  9  9  9  9  9  9  9  9  9
## [21583]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21605]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21627]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21649]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21671]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21693]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21715]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21737]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21759]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21781]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21803]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21825]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21847]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21869]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21891]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21913]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [21935]  9  9  9  9  9  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [21957]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [21979]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22001]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22023]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22045]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22067]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22089]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22111]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22133]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [22155]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  3  3
## [22177]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22199]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22221]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22243]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22265]  3  3  3  3  3  3  3  3  3  3  3  3  3 12 12 12 12 12 12 12 12 12
## [22287] 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12
## [22309] 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12  1  1
## [22331]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [22353]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [22375]  1  1  1  1  1  1  1  1  1  1  1  1  4  4  4  4  4  4  4  4  4  4
## [22397]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22419]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22441]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22463]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22485]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22507]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22529]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22551]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22573]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22595]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22617]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22639]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22661]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22683]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [22705]  4  4  4  4  4  4  4  4  4  4  4  4  3  3  3  3  3  3  3  3  3  3
## [22727]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22749]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22771]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22793]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22815]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22837]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22859]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22881]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22903]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22925]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22947]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22969]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [22991]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [23013]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [23035]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [23057]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  5  5
## [23079]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23101]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23123]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23145]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23167]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23189]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23211]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  2  2  2
## [23233]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23255]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23277]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23299]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23321]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23343]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23365]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23387]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23409]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23431]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23453]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23475]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23497]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23519]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23541]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23563]  2  2  2  2  2  2  2  2  2  2  2  2  2  1  1  1  1  1  1  1  1  1
## [23585]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [23607]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [23629]  1  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [23651]  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9  9
## [23673]  9  9  9  9  9  9  9  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23695]  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5  5
## [23717]  5  5  5  5  5  5  5  5  5  5  5  5  5  5 10 10 10 10 10 10 10 10
## [23739] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [23761] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
## [23783]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [23805]  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8  8
## [23827]  8  8  8  8  8  8  8  8  8  8  8  8  4  4  4  4  4  4  4  4  4  4
## [23849]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [23871]  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4  4
## [23893]  4  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23915]  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2  2
## [23937]  2  2  2  2  2  2  2  2  2  2  2  2  2  7  7  7  7  7  7  7  7  7
## [23959]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [23981]  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7  7
## [24003]  7  7  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [24025]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6
## [24047]  6  6  6  6  6  6  6  6  6  6  6  6  6  6  6  3  3  3  3  3  3  3
## [24069]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [24091]  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3  3
## [24113]  3  3  3  3  3  3  3  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [24135]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
## [24157]  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1  1
# treatment (rewarded at high, low, or full range of frequencies), IT span, colony, trial number, and the interaction of treatment and IT span
m2 = lmer(freq ~ trt + IT_imputed + hive + trialNum + trt:IT_imputed + (1+trialNum|beeColHive), data = sl, REML = FALSE)
summary(m2)
## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: freq ~ trt + IT_imputed + hive + trialNum + trt:IT_imputed +  
##     (1 + trialNum | beeColHive)
##    Data: sl
## 
##       AIC       BIC    logLik  deviance  df.resid 
##  244741.4  244846.6 -122357.7  244715.4     24163 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0041 -0.5147  0.1597  0.6814  4.0131 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev. Corr 
##  beeColHive (Intercept)  907.5   30.12         
##             trialNum     102.1   10.10    -0.77
##  Residual               1440.3   37.95         
## Number of obs: 24176, groups:  beeColHive, 42
## 
## Fixed effects:
##                    Estimate Std. Error t value
## (Intercept)         508.614     43.545  11.680
## trthigh              32.935     40.445   0.814
## trtlow              -64.928     28.900  -2.247
## IT_imputed          -37.023     10.405  -3.558
## hive4               -28.959     16.264  -1.781
## hive5               -34.911     13.817  -2.527
## trialNum              1.335      2.046   0.652
## trthigh:IT_imputed   -4.019      8.990  -0.447
## trtlow:IT_imputed    20.454      6.915   2.958
## 
## Correlation of Fixed Effects:
##             (Intr) trthgh trtlow IT_mpt hive4  hive5  trilNm trth:IT_
## trthigh     -0.080                                                   
## trtlow      -0.180  0.014                                            
## IT_imputed  -0.950  0.064  0.195                                     
## hive4       -0.350  0.064  0.023  0.111                              
## hive5       -0.163  0.061 -0.034 -0.129  0.759                       
## trialNum     0.027 -0.036 -0.095 -0.105 -0.025 -0.029                
## trthgh:IT_m  0.084 -0.998 -0.015 -0.069 -0.063 -0.060  0.033         
## trtlw:IT_mp  0.178 -0.014 -0.997 -0.193 -0.022  0.031  0.089  0.015
# this model estimates a global intercept
# random effect intercept for colNum (beeID)
# a single global estimate for trialNum
# the effect of trialNum within each level of colNum
# the correlation between intercept of trialNum across levels of colNum


vif.mer <- function (fit) {
    ## adapted from rms::vif

    v <- vcov(fit)
    nam <- names(fixef(fit))

    ## exclude intercepts
    ns <- sum(1 * (nam == "Intercept" | nam == "(Intercept)"))
    if (ns > 0) {
        v <- v[-(1:ns), -(1:ns), drop = FALSE]
        nam <- nam[-(1:ns)]
    }

    d <- diag(v)^0.5
    v <- diag(solve(v/(d %o% d)))
    names(v) <- nam
    v
}

vif.mer(m2) # fine
##            trthigh             trtlow         IT_imputed 
##         276.592066         194.117209           1.201656 
##              hive4              hive5           trialNum 
##           2.645079           2.667568           1.029930 
## trthigh:IT_imputed  trtlow:IT_imputed 
##         276.722958         193.727604
m3 = update(m2, .~. - hive)
BIC(m2, m3) # m3 is better (without hive)
##    df      BIC
## m2 13 244846.6
## m3 11 244832.4
anova(m2, m3) # Note: disagrees with BIC
## Data: sl
## Models:
## m3: freq ~ trt + IT_imputed + trialNum + (1 + trialNum | beeColHive) + 
## m3:     trt:IT_imputed
## m2: freq ~ trt + IT_imputed + hive + trialNum + trt:IT_imputed + 
## m2:     (1 + trialNum | beeColHive)
##    Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)  
## m3 11 244743 244832 -122361   244721                           
## m2 13 244741 244847 -122358   244715 5.9991      2    0.04981 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(m3)
## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: 
## freq ~ trt + IT_imputed + trialNum + (1 + trialNum | beeColHive) +  
##     trt:IT_imputed
##    Data: sl
## 
##       AIC       BIC    logLik  deviance  df.resid 
##  244743.4  244832.4 -122360.7  244721.4     24165 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.0026 -0.5121  0.1613  0.6812  4.0225 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev. Corr 
##  beeColHive (Intercept) 1010.0   31.78         
##             trialNum     101.7   10.08    -0.76
##  Residual               1440.4   37.95         
## Number of obs: 24176, groups:  beeColHive, 42
## 
## Fixed effects:
##                    Estimate Std. Error t value
## (Intercept)         494.843     42.810  11.559
## trthigh              40.207     40.456   0.994
## trtlow              -67.847     28.867  -2.350
## IT_imputed          -41.353     10.398  -3.977
## trialNum              1.222      2.040   0.599
## trthigh:IT_imputed   -5.605      8.993  -0.623
## trtlow:IT_imputed    21.086      6.910   3.052
## 
## Correlation of Fixed Effects:
##             (Intr) trthgh trtlow IT_mpt trilNm trth:IT_
## trthigh     -0.061                                     
## trtlow      -0.168  0.013                              
## IT_imputed  -0.993  0.063  0.172                       
## trialNum     0.028 -0.034 -0.095 -0.117                
## trthgh:IT_m  0.066 -0.998 -0.014 -0.068  0.031         
## trtlw:IT_mp  0.166 -0.013 -0.997 -0.171  0.090  0.014
m4 <- update(m3, .~. - IT_imputed:trt)
BIC(m3, m4) # m4 better
##    df      BIC
## m3 11 244832.4
## m4  9 244820.8
summary(m4)
## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: freq ~ trt + IT_imputed + trialNum + (1 + trialNum | beeColHive)
##    Data: sl
## 
##       AIC       BIC    logLik  deviance  df.resid 
##  244748.0  244820.8 -122365.0  244730.0     24167 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9968 -0.5117  0.1600  0.6805  4.0007 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev. Corr 
##  beeColHive (Intercept) 1102.8   33.21         
##             trialNum     148.2   12.18    -0.76
##  Residual               1440.3   37.95         
## Number of obs: 24176, groups:  beeColHive, 42
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept)  477.420     43.063  11.087
## trthigh       14.953      2.462   6.073
## trtlow        20.415      2.103   9.707
## IT_imputed   -37.029     10.446  -3.545
## trialNum       0.787      2.450   0.321
## 
## Correlation of Fixed Effects:
##            (Intr) trthgh trtlow IT_mpt
## trthigh     0.080                     
## trtlow     -0.017  0.012              
## IT_imputed -0.992 -0.084  0.014       
## trialNum   -0.005 -0.042 -0.070 -0.090
m5 <- update(m4, .~. - IT_imputed)
anova(m4, m5) # keep IT, based on BIC
## Data: sl
## Models:
## m5: freq ~ trt + trialNum + (1 + trialNum | beeColHive)
## m4: freq ~ trt + IT_imputed + trialNum + (1 + trialNum | beeColHive)
##    Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)    
## m5  8 244757 244822 -122371   244741                             
## m4  9 244748 244821 -122365   244730 11.294      1  0.0007777 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
m5 <- update(m4, .~. - trt)
anova(m4, m5) # keep trt
## Data: sl
## Models:
## m5: freq ~ IT_imputed + trialNum + (1 + trialNum | beeColHive)
## m4: freq ~ trt + IT_imputed + trialNum + (1 + trialNum | beeColHive)
##    Df    AIC    BIC  logLik deviance Chisq Chi Df Pr(>Chisq)    
## m5  7 244872 244929 -122429   244858                            
## m4  9 244748 244821 -122365   244730   128      2  < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# refit best model with REML = TRUE
m3 <- update(m4, .~., REML = TRUE)
summary(m3) # summary for paper -- leave trial number in, to account for random effect
## Linear mixed model fit by REML ['lmerMod']
## Formula: freq ~ trt + IT_imputed + trialNum + (1 + trialNum | beeColHive)
##    Data: sl
## 
## REML criterion at convergence: 244708.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.9969 -0.5117  0.1598  0.6805  4.0009 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev. Corr 
##  beeColHive (Intercept) 1164.2   34.12         
##             trialNum     160.2   12.66    -0.76
##  Residual               1440.3   37.95         
## Number of obs: 24176, groups:  beeColHive, 42
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept) 478.0876    44.2109  10.814
## trthigh      14.9576     2.4656   6.066
## trtlow       20.4750     2.1078   9.714
## IT_imputed  -37.2000    10.7254  -3.468
## trialNum      0.8128     2.5471   0.319
## 
## Correlation of Fixed Effects:
##            (Intr) trthgh trtlow IT_mpt
## trthigh     0.078                     
## trtlow     -0.015  0.011              
## IT_imputed -0.992 -0.081  0.012       
## trialNum   -0.007 -0.040 -0.068 -0.089
plot(m3)

qqnorm(ranef(m3)$beeColHive[[1]])
qqline(ranef(m3)$beeColHive[[1]])

plot_model(m3) 
## Computing p-values via Wald-statistics approximation (treating t as Wald z).

# plot random effects to find any outliers
plot_model(m3, type = "re")

# post-hoc tests -- pvals for paper
summary(glht(m3, linfct = mcp(trt = "Tukey")), test = adjusted("none"))
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Multiple Comparisons of Means: Tukey Contrasts
## 
## 
## Fit: lmer(formula = freq ~ trt + IT_imputed + trialNum + (1 + trialNum | 
##     beeColHive), data = sl, REML = TRUE)
## 
## Linear Hypotheses:
##                  Estimate Std. Error z value Pr(>|z|)    
## high - full == 0   14.958      2.466   6.066 1.31e-09 ***
## low - full == 0    20.475      2.108   9.714  < 2e-16 ***
## low - high == 0     5.517      3.225   1.711   0.0872 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- none method)
## bonf adjusted pvals
summary(glht(m3, linfct = mcp(trt = "Tukey")), test = adjusted("bonf"))
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Multiple Comparisons of Means: Tukey Contrasts
## 
## 
## Fit: lmer(formula = freq ~ trt + IT_imputed + trialNum + (1 + trialNum | 
##     beeColHive), data = sl, REML = TRUE)
## 
## Linear Hypotheses:
##                  Estimate Std. Error z value Pr(>|z|)    
## high - full == 0   14.958      2.466   6.066 3.92e-09 ***
## low - full == 0    20.475      2.108   9.714  < 2e-16 ***
## low - high == 0     5.517      3.225   1.711    0.261    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- bonferroni method)

Generate CI’s

# set number of bootstrap samples
# refref: change to 10K before knitting
# refref time this
nbootSims = 1000 # ~ 80 minutes on Macbook pro for 10K bootstrap samples, 8min for 1k samples

ITmean = mean(tapply(sl$IT_imputed, INDEX = sl$beeCol, FUN = function(x) x[1] ))
print(ITmean)
## [1] 4.092619
# don't need hive, because that's not in the model we chose (above)
pframe <- data.frame(expand.grid(trt = levels(sl$trt), 
                                 IT_imputed = seq(min(s2$IT_imputed), max(s2$IT_imputed), length.out = 50),  
                                 beeColHive  = 99999, 
                                 trialNum = 2))
pframe$freq <- 0
pp <- predict(m3, newdata = pframe, re.form=NA, type = 'response') # re.form sets all random effects to 0


### Calculate CI's (using bootstrap, not accounting for random effects)
system.time({
  bb2 <- bootMer(m3, FUN=function(x) predict(x, pframe, re.form=NA, type = 'response'), nsim = nbootSims)
})
##    user  system elapsed 
## 499.391   8.727 510.653
print(paste("Number of bootstrap samples", nrow(bb2$t)))
## [1] "Number of bootstrap samples 1000"
bb2_se <-apply(bb2$t,2,function(x) quantile(x, probs = c(0.025, 0.975)))
pframe$blo<-bb2_se[1,]
pframe$bhi<-bb2_se[2,]
pframe$predMean <- pp
pframe <- pframe[, c('trt',"IT_imputed", "blo", "bhi", "predMean")]
pframe
##      trt IT_imputed      blo      bhi predMean
## 1   full   3.480000 334.2230 365.8125 350.2571
## 2   high   3.480000 348.2084 381.7324 365.2147
## 3    low   3.480000 353.7201 386.1669 370.7321
## 4   full   3.509796 333.6298 364.1931 349.1487
## 5   high   3.509796 347.6797 379.8411 364.1063
## 6    low   3.509796 353.1270 384.6172 369.6236
## 7   full   3.539592 333.0366 362.7300 348.0403
## 8   high   3.539592 347.0867 378.1713 362.9979
## 9    low   3.539592 352.2732 383.0708 368.5152
## 10  full   3.569388 332.5813 360.9392 346.9319
## 11  high   3.569388 346.6382 376.6180 361.8895
## 12   low   3.569388 351.6522 381.5019 367.4068
## 13  full   3.599184 332.1179 359.1502 345.8234
## 14  high   3.599184 346.2114 375.1408 360.7811
## 15   low   3.599184 351.1807 379.9709 366.2984
## 16  full   3.628980 331.4765 357.4821 344.7150
## 17  high   3.628980 345.7846 373.6272 359.6726
## 18   low   3.628980 350.7446 378.2269 365.1900
## 19  full   3.658776 330.7758 355.9791 343.6066
## 20  high   3.658776 345.3069 371.9689 358.5642
## 21   low   3.658776 350.1533 376.5867 364.0816
## 22  full   3.688571 330.2518 354.3378 342.4982
## 23  high   3.688571 344.6525 370.3169 357.4558
## 24   low   3.688571 349.5669 374.9649 362.9732
## 25  full   3.718367 329.7984 352.7185 341.3898
## 26  high   3.718367 344.1931 368.6549 356.3474
## 27   low   3.718367 348.9885 373.2344 361.8648
## 28  full   3.748163 329.0903 351.0905 340.2814
## 29  high   3.748163 343.4236 367.0058 355.2390
## 30   low   3.748163 348.3807 371.6339 360.7564
## 31  full   3.777959 328.3977 349.6511 339.1730
## 32  high   3.777959 342.8873 365.3602 354.1306
## 33   low   3.777959 347.8572 370.2670 359.6480
## 34  full   3.807755 327.6790 348.2613 338.0646
## 35  high   3.807755 342.2031 363.9237 353.0222
## 36   low   3.807755 347.1802 368.9554 358.5396
## 37  full   3.837551 327.0812 346.8347 336.9562
## 38  high   3.837551 341.6321 362.6070 351.9138
## 39   low   3.837551 346.6085 367.4033 357.4311
## 40  full   3.867347 326.4866 345.5319 335.8478
## 41  high   3.867347 340.9063 361.0545 350.8054
## 42   low   3.867347 345.8188 365.7878 356.3227
## 43  full   3.897143 325.8903 343.9881 334.7394
## 44  high   3.897143 340.3471 359.8770 349.6970
## 45   low   3.897143 344.9912 364.4010 355.2143
## 46  full   3.926939 325.1045 342.6451 333.6309
## 47  high   3.926939 339.3762 358.3934 348.5886
## 48   low   3.926939 344.2982 363.2147 354.1059
## 49  full   3.956735 324.3076 341.4876 332.5225
## 50  high   3.956735 338.6995 357.1928 347.4801
## 51   low   3.956735 343.6205 362.0037 352.9975
## 52  full   3.986531 323.5189 340.0817 331.4141
## 53  high   3.986531 337.9123 355.8932 346.3717
## 54   low   3.986531 342.8694 360.8123 351.8891
## 55  full   4.016327 322.5212 338.7161 330.3057
## 56  high   4.016327 337.0241 354.5992 345.2633
## 57   low   4.016327 342.1285 359.7719 350.7807
## 58  full   4.046122 321.6481 337.3550 329.1973
## 59  high   4.046122 336.1289 353.3168 344.1549
## 60   low   4.046122 341.2816 358.4632 349.6723
## 61  full   4.075918 320.8410 335.9266 328.0889
## 62  high   4.075918 335.0800 351.9709 343.0465
## 63   low   4.075918 340.2646 357.1499 348.5639
## 64  full   4.105714 319.6784 334.8615 326.9805
## 65  high   4.105714 333.8890 351.0246 341.9381
## 66   low   4.105714 339.4489 356.0236 347.4555
## 67  full   4.135510 318.7003 333.6862 325.8721
## 68  high   4.135510 332.6686 349.8800 340.8297
## 69   low   4.135510 338.3215 354.8551 346.3470
## 70  full   4.165306 317.7977 332.4643 324.7637
## 71  high   4.165306 331.5236 348.5609 339.7213
## 72   low   4.165306 337.4235 353.6575 345.2386
## 73  full   4.195102 316.5609 331.2811 323.6553
## 74  high   4.195102 330.6223 347.6174 338.6129
## 75   low   4.195102 336.1701 352.7036 344.1302
## 76  full   4.224898 315.4364 330.6213 322.5468
## 77  high   4.224898 329.4735 346.7067 337.5045
## 78   low   4.224898 335.0352 351.8690 343.0218
## 79  full   4.254694 314.3151 329.8146 321.4384
## 80  high   4.254694 328.1974 345.8902 336.3961
## 81   low   4.254694 333.5943 350.9359 341.9134
## 82  full   4.284490 312.7474 328.8880 320.3300
## 83  high   4.284490 327.0407 345.0082 335.2876
## 84   low   4.284490 332.3179 350.2661 340.8050
## 85  full   4.314286 311.2283 327.9078 319.2216
## 86  high   4.314286 325.8545 344.1932 334.1792
## 87   low   4.314286 330.9554 349.4553 339.6966
## 88  full   4.344082 309.8186 327.1624 318.1132
## 89  high   4.344082 324.3573 343.4462 333.0708
## 90   low   4.344082 329.5286 348.6454 338.5882
## 91  full   4.373878 308.4691 326.2726 317.0048
## 92  high   4.373878 322.8533 342.3399 331.9624
## 93   low   4.373878 328.0837 347.6198 337.4798
## 94  full   4.403673 306.9018 325.4300 315.8964
## 95  high   4.403673 321.4102 341.4471 330.8540
## 96   low   4.403673 326.6759 346.9153 336.3714
## 97  full   4.433469 305.2534 324.7720 314.7880
## 98  high   4.433469 320.1029 340.5593 329.7456
## 99   low   4.433469 325.0767 346.0657 335.2630
## 100 full   4.463265 303.5359 324.1786 313.6796
## 101 high   4.463265 318.6195 339.8592 328.6372
## 102  low   4.463265 323.5343 345.1844 334.1545
## 103 full   4.493061 301.9081 323.6283 312.5712
## 104 high   4.493061 317.2082 339.3105 327.5288
## 105  low   4.493061 322.0799 344.4173 333.0461
## 106 full   4.522857 300.3723 322.9978 311.4628
## 107 high   4.522857 315.7810 338.8188 326.4204
## 108  low   4.522857 320.5397 343.9762 331.9377
## 109 full   4.552653 298.8682 322.4423 310.3543
## 110 high   4.552653 314.2647 338.0426 325.3120
## 111  low   4.552653 319.0327 343.2451 330.8293
## 112 full   4.582449 297.3124 321.8047 309.2459
## 113 high   4.582449 312.7455 337.4507 324.2036
## 114  low   4.582449 317.2149 342.4412 329.7209
## 115 full   4.612245 295.6605 321.1666 308.1375
## 116 high   4.612245 311.0650 336.9411 323.0951
## 117  low   4.612245 315.5953 341.8644 328.6125
## 118 full   4.642041 293.8647 320.5262 307.0291
## 119 high   4.642041 309.3843 336.4406 321.9867
## 120  low   4.642041 314.1394 340.9325 327.5041
## 121 full   4.671837 292.3362 319.8834 305.9207
## 122 high   4.671837 307.8294 335.7673 320.8783
## 123  low   4.671837 312.5157 340.4934 326.3957
## 124 full   4.701633 290.7996 319.1231 304.8123
## 125 high   4.701633 306.1351 335.0848 319.7699
## 126  low   4.701633 311.0474 339.8004 325.2873
## 127 full   4.731429 289.2914 318.6065 303.7039
## 128 high   4.731429 304.5320 334.3269 318.6615
## 129  low   4.731429 309.3297 339.5053 324.1789
## 130 full   4.761224 287.7832 317.9657 302.5955
## 131 high   4.761224 302.8711 333.5504 317.5531
## 132  low   4.761224 307.6110 338.7806 323.0705
## 133 full   4.791020 286.2531 317.4142 301.4871
## 134 high   4.791020 301.0496 333.0360 316.4447
## 135  low   4.791020 305.9091 338.2959 321.9620
## 136 full   4.820816 284.4511 317.0050 300.3787
## 137 high   4.820816 299.3329 332.4588 315.3363
## 138  low   4.820816 304.1734 337.8113 320.8536
## 139 full   4.850612 282.7752 316.5567 299.2703
## 140 high   4.850612 297.6552 331.8396 314.2279
## 141  low   4.850612 302.4548 337.3094 319.7452
## 142 full   4.880408 281.0615 316.0741 298.1618
## 143 high   4.880408 295.9175 331.2325 313.1195
## 144  low   4.880408 300.7385 336.7415 318.6368
## 145 full   4.910204 279.2977 315.4952 297.0534
## 146 high   4.910204 294.0649 330.7872 312.0111
## 147  low   4.910204 299.0276 336.1702 317.5284
## 148 full   4.940000 277.5930 314.9527 295.9450
## 149 high   4.940000 292.2124 330.3399 310.9026
## 150  low   4.940000 297.3826 335.5993 316.4200

Make plots for paper

#plot 95% confidence intervals
# "Mean and bootstrap CI based on fixed-effects uncertainty ONLY"
# rename labels for plot
pframe$trt3 = plyr::mapvalues(pframe$trt, from = c("full", "high", "low"), 
                        to = c("Full range\n(220 - 450 Hz)", 
                               "High range\n(340 - 390 Hz)",
                               "Low range\n(220 - 330 Hz)"))

 

s44 <- full_join(s2, s4)
## Joining, by = c("beeColHive", "trt2", "trt3")
s2
## # A tibble: 24 x 4
##    beeColHive   trt2   IT_imputed trt3                        
##    <fct>        <chr>       <dbl> <chr>                       
##  1 green.4      full_2       4.21 "Full range\n(220 - 450 Hz)"
##  2 limeblue.5   full_2       4.69 "Full range\n(220 - 450 Hz)"
##  3 limeorange.5 full_2       3.98 "Full range\n(220 - 450 Hz)"
##  4 limepurple.5 low          3.48 "Low range\n(220 - 330 Hz)" 
##  5 limered.5    low          4.15 "Low range\n(220 - 330 Hz)" 
##  6 limewhite.5  full_2       3.76 "Full range\n(220 - 450 Hz)"
##  7 orange.3     high         3.99 "High range\n(340 - 390 Hz)"
##  8 redblue.4    full_2       3.75 "Full range\n(220 - 450 Hz)"
##  9 redgreen.5   full_2       4.12 "Full range\n(220 - 450 Hz)"
## 10 redpink.5    low          4.21 "Low range\n(220 - 330 Hz)" 
## # ... with 14 more rows
s44 %>% print(n = Inf)
## # A tibble: 24 x 6
##    beeColHive    trt2   IT_imputed trt3                  mean_freq sd_freq
##    <fct>         <chr>       <dbl> <chr>                     <dbl>   <dbl>
##  1 green.4       full_2       4.21 "Full range\n(220 - …      285     59.2
##  2 limeblue.5    full_2       4.69 "Full range\n(220 - …      304.    40.1
##  3 limeorange.5  full_2       3.98 "Full range\n(220 - …      345.    26.7
##  4 limepurple.5  low          3.48 "Low range\n(220 - 3…      344.    32.6
##  5 limered.5     low          4.15 "Low range\n(220 - 3…      365.    37.1
##  6 limewhite.5   full_2       3.76 "Full range\n(220 - …      327.    35.5
##  7 orange.3      high         3.99 "High range\n(340 - …      382.    27.5
##  8 redblue.4     full_2       3.75 "Full range\n(220 - …      341.    43.3
##  9 redgreen.5    full_2       4.12 "Full range\n(220 - …      326.    36.4
## 10 redpink.5     low          4.21 "Low range\n(220 - 3…      290.    39.1
## 11 redpurple.5   high         4.34 "High range\n(340 - …      336.    36.2
## 12 white.4       full_2       4.03 "Full range\n(220 - …      314.    45.7
## 13 whiteblue.5   low          4.34 "Low range\n(220 - 3…      348.    33.4
## 14 whitegold.5   low          4.63 "Low range\n(220 - 3…      330.    40.8
## 15 whiteorange.5 low          4.46 "Low range\n(220 - 3…      361.    39.1
## 16 whitepink.5   high         4.59 "High range\n(340 - …      326.    29.9
## 17 whitered.5    high         4.42 "High range\n(340 - …      322.    43.4
## 18 whiteyellow.5 full_2       4.24 "Full range\n(220 - …      324.    32.9
## 19 yellowblue.5  high         4.94 "High range\n(340 - …      309.    44.0
## 20 yellowgreen.5 full_2       4.14 "Full range\n(220 - …      283.    35.5
## 21 yelloworange… high         4.34 "High range\n(340 - …      312.    35.9
## 22 yellowpink.5  low          3.87 "Low range\n(220 - 3…      346.    40.8
## 23 yellowpurple… low          3.82 "Low range\n(220 - 3…      361.    41.8
## 24 yellowred.5   full_2       4.07 "Full range\n(220 - …      339.    32.3
set.seed(1234)
g0 <- ggplot(pframe, aes(x=IT_imputed, y=predMean, color = trt3, fill = trt3))+
        geom_line()+
        facet_wrap(~trt3) + 
        geom_rug(data = s44, aes(x = IT_imputed, color = trt3, y = s44$mean_freq), 
                 inherit.aes = FALSE, sides = "b", 
                 position = position_jitter(height = 0, width = 0.03)) + 
        labs(y = "Sonication frequency (Hz)", x = "Intertegular span (mm)") + 
        geom_ribbon(aes(ymin = blo, ymax = bhi), alpha = 0.3, color = NA)+
        # geom_point(data = s44, aes(y= mean_freq)) +
        # geom_errorbar(data = s44, aes(x = IT_imputed, ymin = mean_freq - sd_freq,
        #                               ymax = mean_freq + sd_freq, color = trt3),
        #               inherit.aes = FALSE, width = 0.1) +
        theme(plot.background = element_rect(fill = "transparent",colour = NA), 
            panel.background = element_rect(fill = "transparent",colour = NA), 
            legend.position ="none", 
            legend.background = element_rect(fill="transparent", colour = NA),
            strip.background = element_blank(), 
            panel.spacing.x = unit(1, "lines"), 
           plot.margin = margin(c(0.2,0.51, 0.2, 0.2), unit = "cm")) +
        #scale_x_continuous(breaks = seq(3.4, 4.8, by = 0.5)) +
        scale_color_viridis_d(name = "Frequency range\nfor reward", end = 0.7, option = "inferno") + 
        scale_fill_viridis_d(name = "Frequency range\nfor reward", end =0.7, option = 'inferno')
g0

ggsave(plot = g0, filename = file.path(figDir, "SonicationFreqPredsAndCI_unadjusted.png"), unit = "in", dpi = 500,
       width = 5, height = 4)
ggsave(plot = g0, filename = file.path(figDir, "SonicationFreqPredsAndCI_unadjusted.svg"), width = 5, height = 4)

make a different version of the plot

g1 <- ggplot(pframe, aes(x=IT_imputed, y=predMean, color = trt3, fill = trt3))+
        geom_line()+
        #facet_wrap(~trt3) + 
        # geom_rug(data = s44, aes(x = IT_imputed, color = trt3, y = s44$mean_freq), 
        #          inherit.aes = FALSE, sides = "b", 
        #          position = position_jitter(height = 0, width = 0.03)) + 
        labs(y = "Sonication frequency (Hz)", x = "Intertegular span (mm)") + 
        geom_ribbon(aes(ymin = blo, ymax = bhi), alpha = 0.3, color = NA)+
        # geom_point(data = s44, aes(y= mean_freq)) +
        # geom_errorbar(data = s44, aes(x = IT_imputed, ymin = mean_freq - sd_freq,
        #                               ymax = mean_freq + sd_freq, color = trt3),
        #               inherit.aes = FALSE, width = 0.1) +
        theme(plot.background = element_rect(fill = "transparent",colour = NA), 
            panel.background = element_rect(fill = "transparent",colour = NA), 
            legend.position =c(0.8, 0.8), 
            legend.background = element_rect(fill="transparent", colour = NA),
            strip.background = element_blank(),
            legend.title = element_text(size = 8),
            panel.spacing.x = unit(1, "lines"), 
           plot.margin = margin(c(0.2,0.51, 0.2, 0.2), unit = "cm")) +
        #scale_x_continuous(breaks = seq(3.4, 4.8, by = 0.5)) +
        scale_color_viridis_d(name = "Frequency range\nfor reward", end = 0.7, option = "inferno") + 
        scale_fill_viridis_d(name = "Frequency range\nfor reward", end =0.7, option = 'inferno')
g1

ggsave(plot = g1, filename = file.path(figDir, "SonicationFreqPredsAndCI_unadjusted_overlap.png"), unit = "in", dpi = 500,
       width = 6.5/2, height = 2.5)

svg(file.path(figDir, "SonicationFreqPredsAndCI_unadjusted_overlap.svg"), width = 6.5/2, height = 4)
g1
dev.off()
## quartz_off_screen 
##                 2

visualization of frequency over time

sl <- read_csv(file.path(dataDir, '01_CombinedTrials_cleaned.csv'))
## Parsed with column specification:
## cols(
##   .default = col_integer(),
##   beeCol = col_character(),
##   meanFreq = col_double(),
##   IT_imputed = col_double(),
##   freq = col_double(),
##   amp = col_double(),
##   datetime = col_character(),
##   rewTF = col_logical(),
##   BeeNumCol = col_character(),
##   accFile = col_character(),
##   datetime_str = col_datetime(format = ""),
##   IT = col_double(),
##   trt = col_character(),
##   amp_acc = col_double()
## )
## See spec(...) for full column specifications.
colnames(sl)
##  [1] "beeCol"       "hive"         "meanFreq"     "IT_imputed"  
##  [5] "index"        "freq"         "amp"          "datetime"    
##  [9] "rewNum"       "rewTF"        "lowRewAmp"    "highrewAmp"  
## [13] "BeeNumCol"    "accFile"      "trialNum"     "datetime_str"
## [17] "lowFrq"       "highFrq"      "IT"           "trt"         
## [21] "amp_acc"
sl <- sl %>%
  # gets rid of the copious warnings
  mutate(timeSinceStart = NA, timeSinceLastBuzz = NA, buzzesSinceReward = NA) %>%
  mutate(beeColHive = interaction(beeCol, hive)) %>%
  # remove two trials I messed up
  filter(!(beeCol == "whitepink" & trialNum == 3)) %>%
  filter(!(beeCol == "limepurple" & trialNum == 3)) %>%
  mutate(t5 = recode(.$trt, "full" = "Full range\n(220 - 450 Hz)", 
                       "high" = "High range\n(340 - 390 Hz)\nsecond trial", 
                       "low" = "Low range\n(220 - 330 Hz)\nsecond trial")) %>%
  mutate(t6 = t5, 
         t6 = ifelse(.$trt == 'full' & .$trialNum == 1, 
                     "Full range \n(220 - 450 Hz)\nfirst trial", t5), 
         t6 = ifelse(.$trt == 'full' & .$trialNum > 1, 
                     "Full range \n(220 - 450 Hz)\nsecond trial", t6)
         )



st <- sl %>%
  filter(trialNum <= 10 & trialNum > 1) 


fta <- sl %>% 
  filter(trialNum == 1) %>% 
  dplyr::group_by(beeColHive) %>%
  dplyr::summarise(initialFreq = mean(freq)) %>%
  full_join(sl) %>%
  mutate(freqDiff = freq- initialFreq) %>%
  filter(beeColHive %in% .$beeColHive[.$trialNum > 1]) %>%
  dplyr::arrange(trt) 
## Joining, by = "beeColHive"
fta[fta$beeColHive == "limepurple.5", ]
## # A tibble: 296 x 29
##    beeColHive initialFreq beeCol  hive meanFreq IT_imputed index  freq
##    <fct>            <dbl> <chr>  <int>    <dbl>      <dbl> <int> <dbl>
##  1 limepurpl…        352. limep…     5     341.       3.48     1   410
##  2 limepurpl…        352. limep…     5     341.       3.48     2   310
##  3 limepurpl…        352. limep…     5     341.       3.48     3   390
##  4 limepurpl…        352. limep…     5     341.       3.48     4   370
##  5 limepurpl…        352. limep…     5     341.       3.48     5   370
##  6 limepurpl…        352. limep…     5     341.       3.48     6   330
##  7 limepurpl…        352. limep…     5     341.       3.48     7   360
##  8 limepurpl…        352. limep…     5     341.       3.48     8   360
##  9 limepurpl…        352. limep…     5     341.       3.48     9   240
## 10 limepurpl…        352. limep…     5     341.       3.48    10   300
## # ... with 286 more rows, and 21 more variables: amp <dbl>,
## #   datetime <chr>, rewNum <int>, rewTF <lgl>, lowRewAmp <int>,
## #   highrewAmp <int>, BeeNumCol <chr>, accFile <chr>, trialNum <int>,
## #   datetime_str <dttm>, lowFrq <int>, highFrq <int>, IT <dbl>, trt <chr>,
## #   amp_acc <dbl>, timeSinceStart <lgl>, timeSinceLastBuzz <lgl>,
## #   buzzesSinceReward <lgl>, t5 <chr>, t6 <chr>, freqDiff <dbl>
cc <- fta %>%
  filter(trialNum > 1) %>%
  group_by(beeColHive) %>%
  summarize(meanFreq = mean(freq))
cc %>% print(n = Inf)
## # A tibble: 24 x 2
##    beeColHive     meanFreq
##    <fct>             <dbl>
##  1 orange.3           382.
##  2 green.4            285 
##  3 redblue.4          341.
##  4 white.4            314.
##  5 limeblue.5         304.
##  6 limeorange.5       345.
##  7 limepurple.5       344.
##  8 limered.5          365.
##  9 limewhite.5        327.
## 10 redgreen.5         326.
## 11 redpink.5          290.
## 12 redpurple.5        336.
## 13 whiteblue.5        348.
## 14 whitegold.5        330.
## 15 whiteorange.5      361.
## 16 whitepink.5        326.
## 17 whitered.5         322.
## 18 whiteyellow.5      324.
## 19 yellowblue.5       309.
## 20 yellowgreen.5      283.
## 21 yelloworange.5     312.
## 22 yellowpink.5       346.
## 23 yellowpurple.5     361.
## 24 yellowred.5        339.
bb <- fta %>%
  dplyr::select(beeColHive, trt, trialNum, initialFreq) %>%
  dplyr::filter(trialNum == 2 | trialNum == 3) %>%
  group_by(beeColHive) %>% 
  slice(1:1) %>%
  full_join(cc) %>%
  mutate(freqDiff = initialFreq - meanFreq) %>%
  dplyr::arrange(trt, desc(freqDiff))
## Joining, by = "beeColHive"
bb
## # A tibble: 24 x 6
## # Groups:   beeColHive [24]
##    beeColHive    trt   trialNum initialFreq meanFreq freqDiff
##    <fct>         <chr>    <int>       <dbl>    <dbl>    <dbl>
##  1 green.4       full         2        319.     285     33.9 
##  2 white.4       full         3        343.     314.    28.8 
##  3 yellowgreen.5 full         2        298.     283.    14.7 
##  4 redgreen.5    full         2        335.     326.     8.63
##  5 redblue.4     full         3        342.     341.     1.03
##  6 limeblue.5    full         3        302.     304.    -1.93
##  7 yellowred.5   full         2        320.     339.   -19.3 
##  8 whiteyellow.5 full         2        303.     324.   -20.6 
##  9 limewhite.5   full         2        292      327.   -35.1 
## 10 limeorange.5  full         2        286.     345.   -58.8 
## # ... with 14 more rows
fta <- fta %>%
  mutate(beeColHive = factor(beeColHive, levels = bb$beeColHive)) %>% 
  mutate(t5 = recode(.$trt, "full" = "Full range\n(220 - 450 Hz)", 
                       "high" = "High range\n(340 - 390 Hz)", 
                       "low" = "Low range\n(220 - 330 Hz)")) %>%
  filter(trialNum <= 10)



s44 = fta %>%
  group_by(trialNum, beeColHive, t5) %>%
  dplyr::summarise(meanFreq2 = mean(freq))
s44
## # A tibble: 175 x 4
## # Groups:   trialNum, beeColHive [?]
##    trialNum beeColHive    t5                           meanFreq2
##       <int> <fct>         <chr>                            <dbl>
##  1        1 green.4       "Full range\n(220 - 450 Hz)"      319.
##  2        1 white.4       "Full range\n(220 - 450 Hz)"      343.
##  3        1 yellowgreen.5 "Full range\n(220 - 450 Hz)"      298.
##  4        1 redgreen.5    "Full range\n(220 - 450 Hz)"      335.
##  5        1 redblue.4     "Full range\n(220 - 450 Hz)"      342.
##  6        1 limeblue.5    "Full range\n(220 - 450 Hz)"      302.
##  7        1 yellowred.5   "Full range\n(220 - 450 Hz)"      320.
##  8        1 whiteyellow.5 "Full range\n(220 - 450 Hz)"      303.
##  9        1 limewhite.5   "Full range\n(220 - 450 Hz)"      292 
## 10        1 limeorange.5  "Full range\n(220 - 450 Hz)"      286.
## # ... with 165 more rows
# plot to show trials

ggplot(fta, aes(x = trialNum, y = freq, color = t5)) + 
  geom_ribbon(data = fta[fta$trialNum > 1,], 
              aes(x = rep(seq(1.5, 12, 3),  
                          length.out = nrow(fta[fta$trialNum > 1,])), 
                  ymin = lowFrq, ymax = highFrq), alpha = 0.2, color = NA) + 
  geom_point(position = position_jitter(width = 0, height = 10), 
             alpha= 0.2, stroke = 0, aes( shape = t5 )) + 
  
  facet_wrap(~beeColHive, ncol = 8) +
    
  geom_line(data = s44, aes(x = trialNum, y = meanFreq2), color = 'black', lwd = 0.8, show.legend = FALSE) + 
  geom_line(data = s44, aes(x = trialNum, y = meanFreq2, color = t5), lwd = 0.8, show.legend = FALSE) + 
  
  geom_point(data = s44, aes(x = trialNum, y = meanFreq2), 
             color = 'black', pch = 18, show.legend = FALSE) + 

  
  geom_ribbon(data = fta[fta$trialNum > 1,], 
              aes(x = rep(seq(0.5, 1.5, 1),  
                          length.out = nrow(fta[fta$trialNum > 1,])), 
                  ymin = 220, ymax = 450), alpha = 0.2, color = NA) + 
  geom_hline(aes(yintercept = initialFreq)) + 
  # stat_smooth(data = fta[fta$trialNum > 1,], 
  #             method = 'loess', se = FALSE, 
  #             size =1.5, color = 'black', span = 0.6) + 
  # stat_smooth(data = fta[fta$trialNum > 1,], 
  #             method = 'loess', 
  #             se = FALSE, size =1, span = 0.6) + 
  scale_x_continuous(breaks = seq(0, 10, 2)) + 
  scale_color_viridis_d(name = "",
                        option = "magma", begin = 0.3,
                        end = 0.80, 
                        guide = guide_legend(override.aes = list(alpha = 1, size = 4))) + 
  theme_classic() + 
  theme(strip.background = element_blank(), 
        strip.text = element_blank(), 
        panel.border = element_rect(colour = "grey40", 
                                    fill=NA, size=0.5), 
        legend.position = 'top') + 
  scale_shape_manual(name = "", values = c(16,17,15)) + 
   
  labs(y = "Frequency (Hz)", x = "Trial Number")
## geom_path: Each group consists of only one observation. Do you need to
## adjust the group aesthetic?

ggsave(filename = file.path(figDir,"freqLearningCurve.png"),
       dpi = 500,  width = 6.5*1.5, height = 4*1.5, units = "in")
## geom_path: Each group consists of only one observation. Do you need to
## adjust the group aesthetic?
options(digits.secs=6)
# plot buzzes for first trial
ftrl <- sl %>%
  filter(trialNum  <= 2 ) %>%
  mutate(dateTime_fmt= as.POSIXct(strptime(x = .$datetime_str, 
                                           format = "%Y-%m-%d  %H:%M:%OS" ))) %>%
  arrange(dateTime_fmt) %>%
  group_by(beeColHive) %>%
  mutate(index = row_number())
  
dd = sl %>%
  filter(trialNum == 2 | trialNum == 3) %>%
  mutate(trialNum = 99) %>%
  ungroup() %>%
  group_by(beeColHive, trt, trialNum) %>%
  summarise(meanTT = n()) %>%
  arrange(trt, meanTT)
dd
## # A tibble: 24 x 4
## # Groups:   beeColHive, trt [24]
##    beeColHive    trt   trialNum meanTT
##    <fct>         <chr>    <dbl>  <int>
##  1 green.4       full        99      4
##  2 limeorange.5  full        99     51
##  3 limewhite.5   full        99     51
##  4 whiteyellow.5 full        99    102
##  5 limeblue.5    full        99    104
##  6 redgreen.5    full        99    104
##  7 yellowgreen.5 full        99    106
##  8 white.4       full        99    113
##  9 yellowred.5   full        99    114
## 10 redblue.4     full        99    127
## # ... with 14 more rows
dd %>% print(n = Inf)
## # A tibble: 24 x 4
## # Groups:   beeColHive, trt [24]
##    beeColHive     trt   trialNum meanTT
##    <fct>          <chr>    <dbl>  <int>
##  1 green.4        full        99      4
##  2 limeorange.5   full        99     51
##  3 limewhite.5    full        99     51
##  4 whiteyellow.5  full        99    102
##  5 limeblue.5     full        99    104
##  6 redgreen.5     full        99    104
##  7 yellowgreen.5  full        99    106
##  8 white.4        full        99    113
##  9 yellowred.5    full        99    114
## 10 redblue.4      full        99    127
## 11 orange.3       high        99     11
## 12 whitepink.5    high        99    143
## 13 redpurple.5    high        99    163
## 14 yellowblue.5   high        99    220
## 15 whitered.5     high        99    364
## 16 yelloworange.5 high        99    381
## 17 redpink.5      low         99    129
## 18 whitegold.5    low         99    142
## 19 limepurple.5   low         99    243
## 20 yellowpink.5   low         99    245
## 21 whiteblue.5    low         99    621
## 22 limered.5      low         99    632
## 23 whiteorange.5  low         99    692
## 24 yellowpurple.5 low         99    706
ee = sl %>%
  filter(trialNum == 1) %>%
  ungroup() %>%
  group_by(beeColHive, trt, trialNum) %>%
  summarise(meanTT = n()) %>%
  rbind(dd) %>%
  arrange(beeColHive, desc(trialNum)) %>%
  group_by(beeColHive) %>%
  filter(row_number(beeColHive) == 1) %>%
  arrange(trt, meanTT)
  
ee %>% print(n = Inf)
## # A tibble: 43 x 4
## # Groups:   beeColHive [43]
##    beeColHive         trt   trialNum meanTT
##    <fct>              <chr>    <dbl>  <int>
##  1 goldred.4          full         1      3
##  2 limesilver.5       full         1      3
##  3 green.4            full        99      4
##  4 purple.3           full         1      9
##  5 silver.5           full         1     26
##  6 lime.5             full         1     28
##  7 blue.4             full         1     36
##  8 whitegreen.4       full         1     39
##  9 limegreen.5        full         1     50
## 10 orangeblue.5       full         1     50
## 11 orangegreen.5      full         1     50
## 12 orangepink.5       full         1     50
## 13 orangepurple.5     full         1     50
## 14 limeorange.5       full        99     51
## 15 limepink.5         full         1     51
## 16 limewhite.5        full        99     51
## 17 orange.5           full         1     51
## 18 limeyellow.5       full         1     52
## 19 gold.3             full         1     54
## 20 limegold.5         full         1     54
## 21 whitepurple.5      full         1     55
## 22 limepurpleyellow.5 full         1     58
## 23 whiteyellow.5      full        99    102
## 24 limeblue.5         full        99    104
## 25 redgreen.5         full        99    104
## 26 yellowgreen.5      full        99    106
## 27 white.4            full        99    113
## 28 yellowred.5        full        99    114
## 29 redblue.4          full        99    127
## 30 orange.3           high        99     11
## 31 whitepink.5        high        99    143
## 32 redpurple.5        high        99    163
## 33 yellowblue.5       high        99    220
## 34 whitered.5         high        99    364
## 35 yelloworange.5     high        99    381
## 36 redpink.5          low         99    129
## 37 whitegold.5        low         99    142
## 38 limepurple.5       low         99    243
## 39 yellowpink.5       low         99    245
## 40 whiteblue.5        low         99    621
## 41 limered.5          low         99    632
## 42 whiteorange.5      low         99    692
## 43 yellowpurple.5     low         99    706
unique(dd$beeColHive)
##  [1] green.4        limeorange.5   limewhite.5    whiteyellow.5 
##  [5] limeblue.5     redgreen.5     yellowgreen.5  white.4       
##  [9] yellowred.5    redblue.4      orange.3       whitepink.5   
## [13] redpurple.5    yellowblue.5   whitered.5     yelloworange.5
## [17] redpink.5      whitegold.5    limepurple.5   yellowpink.5  
## [21] whiteblue.5    limered.5      whiteorange.5  yellowpurple.5
## 126 Levels: blue.3 gold.3 goldred.3 green.3 lime.3 ... yellowred.5
unique(ftrl$beeColHive)
##  [1] blue.4             orange.3           white.4           
##  [4] gold.3             redblue.4          green.4           
##  [7] purple.3           whitegreen.4       whitepink.5       
## [10] whitepurple.5      goldred.4          whiteorange.5     
## [13] whiteyellow.5      whitegold.5        whiteblue.5       
## [16] whitered.5         yellowred.5        yellowgreen.5     
## [19] yellowpurple.5     yelloworange.5     yellowpink.5      
## [22] yellowblue.5       redgreen.5         redpink.5         
## [25] redpurple.5        silver.5           lime.5            
## [28] limered.5          limeblue.5         limesilver.5      
## [31] limepurple.5       limewhite.5        limepurpleyellow.5
## [34] limeorange.5       orange.5           limepink.5        
## [37] limegreen.5        limeyellow.5       limegold.5        
## [40] orangepink.5       orangegreen.5      orangepurple.5    
## [43] orangeblue.5      
## 126 Levels: blue.3 gold.3 goldred.3 green.3 lime.3 ... yellowred.5
ftrl = ftrl %>%
  ungroup() %>%
  mutate(beeColHive = factor(.$beeColHive, levels = ee$beeColHive)) %>%
  filter(beeColHive %in% ee$beeColHive[ee$meanTT > 20]) 

ggplot(ftrl, aes(x = index, y = freq, color = t6)) + 
  
  geom_point(alpha = 0.4, stroke = 0, aes(shape = t6)) + 
  facet_wrap(~beeColHive, ncol = 8 ) + 
  stat_smooth(aes(group = t6), method = 'loess', color = "black", se = FALSE, span = 0.7, lwd = 0.4) + 
  scale_color_viridis_d(name = "",
                        option = "magma", begin = 0.3,
                        end = 0.80, 
                        guide = guide_legend(override.aes = list(alpha = 1, size = 4))) + 
  scale_shape_manual(name = "", values = c(16,17,15, 18)) + 
  theme_classic() + 
  theme(strip.background = element_blank(), 
        strip.text = element_blank(), 
        panel.border = element_rect(colour = "grey40", 
                                    fill=NA, size=0.5), 
        legend.position = 'top')  + 
  scale_x_continuous(breaks = seq(0, 400, 200), limits = c(0, 400)) + 
  labs(x = "Sonication Number", y =  "Frequency (Hz)") + 
  geom_ribbon(aes(ymin = lowFrq, ymax = highFrq), alpha = 0.2, color = NA)

ggsave(filename = file.path(figDir,"FreqChangeFirstAndSecTrial.png"),
       dpi = 500,  width = 6.5*1.5, height = 4*1.5, units = "in")



ggplot(ftrl[ftrl$trialNum == 1,], aes(x = index, y = freq, color = t6)) + 
  
  geom_point(alpha = 0.4, stroke = 0, aes(shape = t6)) + 
  facet_wrap(~beeColHive, ncol = 8 ) + 
  stat_smooth(aes(group = t6), method = 'loess', color = "black", se = FALSE,span =0.7, lwd = 0.4) + 
  scale_color_viridis_d(name = "",
                        option = "magma", begin = 0.3,
                        end = 0.80, 
                        guide = guide_legend(override.aes = list(alpha = 1, size = 4))) + 
  scale_shape_manual(name = "", values = c(16,17,15, 18)) + 
  theme_classic() + 
  theme(strip.background = element_blank(), 
        strip.text = element_blank(), 
        panel.border = element_rect(colour = "grey40", 
                                    fill=NA, size=0.5), 
        legend.position = 'top')  + 
  scale_x_continuous(breaks = seq(0, 50, 20), limits = c(0, 50)) + 
  labs(x = "Sonication Number", y =  "Frequency (Hz)") 
## Warning: Removed 106 rows containing non-finite values (stat_smooth).
## Warning: Removed 106 rows containing missing values (geom_point).

ggsave(filename = file.path(figDir,"FreqChangeFirstTrial.png"),
       dpi = 500,  width = 6.5*1.5, height = 4*1.5, units = "in")
## Warning: Removed 106 rows containing non-finite values (stat_smooth).

## Warning: Removed 106 rows containing missing values (geom_point).

look at acceleration change over time

sl <- sl %>%
  # gets rid of the copious warnings
  mutate(timeSinceStart = NA, timeSinceLastBuzz = NA, buzzesSinceReward = NA) %>%
  mutate(beeColHive = interaction(beeCol, hive)) %>%
  # remove two trials I messed up
  filter(!(beeCol == "whitepink" & trialNum == 3)) %>%
  filter(!(beeCol == "limepurple" & trialNum == 3)) %>%
  mutate(amp_acc2 = amp_acc / 2)




fta <- sl %>% 
  filter(trialNum == 1) %>% 
  dplyr::group_by(beeColHive) %>%
  dplyr::summarise(initialAmp = mean(amp_acc2)) %>%
  full_join(sl) %>%
  mutate(ampDiff = amp_acc2- initialAmp) %>%
  filter(beeColHive %in% .$beeColHive[.$trialNum > 1]) %>%
  dplyr::arrange(trt) 
## Joining, by = "beeColHive"
fta[fta$beeColHive == "limepurple.5", ]
## # A tibble: 296 x 30
##    beeColHive initialAmp beeCol  hive meanFreq IT_imputed index  freq   amp
##    <fct>           <dbl> <chr>  <int>    <dbl>      <dbl> <int> <dbl> <dbl>
##  1 limepurpl…       22.0 limep…     5     341.       3.48     1   410 0.766
##  2 limepurpl…       22.0 limep…     5     341.       3.48     2   310 0.142
##  3 limepurpl…       22.0 limep…     5     341.       3.48     3   390 0.482
##  4 limepurpl…       22.0 limep…     5     341.       3.48     4   370 0.439
##  5 limepurpl…       22.0 limep…     5     341.       3.48     5   370 0.482
##  6 limepurpl…       22.0 limep…     5     341.       3.48     6   330 0.368
##  7 limepurpl…       22.0 limep…     5     341.       3.48     7   360 0.572
##  8 limepurpl…       22.0 limep…     5     341.       3.48     8   360 0.538
##  9 limepurpl…       22.0 limep…     5     341.       3.48     9   240 0.684
## 10 limepurpl…       22.0 limep…     5     341.       3.48    10   300 0.413
## # ... with 286 more rows, and 21 more variables: datetime <chr>,
## #   rewNum <int>, rewTF <lgl>, lowRewAmp <int>, highrewAmp <int>,
## #   BeeNumCol <chr>, accFile <chr>, trialNum <int>, datetime_str <dttm>,
## #   lowFrq <int>, highFrq <int>, IT <dbl>, trt <chr>, amp_acc <dbl>,
## #   timeSinceStart <lgl>, timeSinceLastBuzz <lgl>,
## #   buzzesSinceReward <lgl>, t5 <chr>, t6 <chr>, amp_acc2 <dbl>,
## #   ampDiff <dbl>
cc <- fta %>%
  filter(trialNum > 1) %>%
  group_by(beeColHive) %>%
  summarize(meanAmp = mean(amp_acc2))
cc %>% print(n = Inf)
## # A tibble: 24 x 2
##    beeColHive     meanAmp
##    <fct>            <dbl>
##  1 orange.3         28.9 
##  2 green.4           9.60
##  3 redblue.4        23.0 
##  4 white.4          23.9 
##  5 limeblue.5       32.9 
##  6 limeorange.5     25.4 
##  7 limepurple.5     20.0 
##  8 limered.5        19.2 
##  9 limewhite.5      20.5 
## 10 redgreen.5       40.0 
## 11 redpink.5        35.8 
## 12 redpurple.5      26.4 
## 13 whiteblue.5      42.4 
## 14 whitegold.5      31.9 
## 15 whiteorange.5    25.9 
## 16 whitepink.5      29.0 
## 17 whitered.5       38.4 
## 18 whiteyellow.5    30.7 
## 19 yellowblue.5     33.7 
## 20 yellowgreen.5    40.0 
## 21 yelloworange.5   35.2 
## 22 yellowpink.5     30.0 
## 23 yellowpurple.5   31.3 
## 24 yellowred.5      28.1
# use bb from above, to maintain order
# bb <- fta %>%
#   dplyr::select(beeColHive, trt, trialNum, initialAmp) %>%
#   dplyr::filter(trialNum == 2 | trialNum == 3) %>%
#   group_by(beeColHive) %>% 
#   slice(1:1) %>%
#   full_join(cc) %>%
#   mutate(ampDiff = initialAmp - meanAmp) %>%
#   dplyr::arrange(trt, desc(ampDiff))
# 
# bb

fta <- fta %>%
  mutate(beeColHive = factor(beeColHive, levels = bb$beeColHive), 
       t5 = plyr::mapvalues(.$trt, from = c("full", "high", "low"), 
                        to = c("Full range\n(220 - 450 Hz)", 
                               "High range\n(340 - 390 Hz)", "Low range\n(220 - 330 Hz)"))) %>%
  filter(trialNum <= 10)



s44 = fta %>%
  group_by(trialNum, beeColHive, t5) %>%
  dplyr::summarise(meanamp2 = mean(amp_acc2))
s44
## # A tibble: 175 x 4
## # Groups:   trialNum, beeColHive [?]
##    trialNum beeColHive    t5                           meanamp2
##       <int> <fct>         <chr>                           <dbl>
##  1        1 green.4       "Full range\n(220 - 450 Hz)"     22.1
##  2        1 white.4       "Full range\n(220 - 450 Hz)"     23.9
##  3        1 yellowgreen.5 "Full range\n(220 - 450 Hz)"     30.8
##  4        1 redgreen.5    "Full range\n(220 - 450 Hz)"     39.4
##  5        1 redblue.4     "Full range\n(220 - 450 Hz)"     14.4
##  6        1 limeblue.5    "Full range\n(220 - 450 Hz)"     24.6
##  7        1 yellowred.5   "Full range\n(220 - 450 Hz)"     31.4
##  8        1 whiteyellow.5 "Full range\n(220 - 450 Hz)"     32.8
##  9        1 limewhite.5   "Full range\n(220 - 450 Hz)"     18.8
## 10        1 limeorange.5  "Full range\n(220 - 450 Hz)"     21.6
## # ... with 165 more rows
# plot to show trials

ggplot(fta, aes(x = trialNum, y = amp_acc2, color = t5)) + 
  
  geom_point(position = position_jitter(width = 0, height = 0 ), 
             alpha= 0.2, stroke = 0, aes( shape = t5 )) + 
  
  facet_wrap(~beeColHive, ncol = 8) +
    
  geom_line(data = s44, aes(x = trialNum, y = meanamp2), color = 'black', lwd = 0.8, show.legend = FALSE) + 
  geom_line(data = s44, aes(x = trialNum, y = meanamp2, color = t5), lwd = 0.8, show.legend = FALSE) + 
  
  geom_point(data = s44, aes(x = trialNum, y = meanamp2), 
             color = 'black', pch = 18, show.legend = FALSE) + 

  geom_hline(aes(yintercept = initialAmp)) + 
  # stat_smooth(data = fta[fta$trialNum > 1,], 
  #             method = 'loess', se = FALSE, 
  #             size =1.5, color = 'black', span = 0.6) + 
  # stat_smooth(data = fta[fta$trialNum > 1,], 
  #             method = 'loess', 
  #             se = FALSE, size =1, span = 0.6) + 
  scale_x_continuous(breaks = seq(0, 10, 2)) + 
  scale_color_viridis_d(name = "",
                        option = "magma", begin = 0.3,
                        end = 0.80, 
                        guide = guide_legend(override.aes = list(alpha = 1, size = 4))) + 
  theme_classic() + 
  theme(strip.background = element_blank(), 
        strip.text = element_blank(), 
        panel.border = element_rect(colour = "grey40", 
                                    fill=NA, size=0.5), 
        legend.position = 'top') + 
  scale_shape_manual(name = "", values = c(16,17,15)) + 
   
  labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Trial Number")
## geom_path: Each group consists of only one observation. Do you need to
## adjust the group aesthetic?

ggsave(filename = file.path(figDir,"AmplChangeOverTime.png"),
       dpi = 200,  width = 6.5*1.5, height = 4*1.5, units = "in")
## geom_path: Each group consists of only one observation. Do you need to
## adjust the group aesthetic?

____ END OF ANALYSIS FOR PAPER ____

Analysis for acceleration

sl <- read_csv(file.path(dataDir, '01_CombinedTrials_cleaned.csv'))
## Parsed with column specification:
## cols(
##   .default = col_integer(),
##   beeCol = col_character(),
##   meanFreq = col_double(),
##   IT_imputed = col_double(),
##   freq = col_double(),
##   amp = col_double(),
##   datetime = col_character(),
##   rewTF = col_logical(),
##   BeeNumCol = col_character(),
##   accFile = col_character(),
##   datetime_str = col_datetime(format = ""),
##   IT = col_double(),
##   trt = col_character(),
##   amp_acc = col_double()
## )
## See spec(...) for full column specifications.
colnames(sl)
##  [1] "beeCol"       "hive"         "meanFreq"     "IT_imputed"  
##  [5] "index"        "freq"         "amp"          "datetime"    
##  [9] "rewNum"       "rewTF"        "lowRewAmp"    "highrewAmp"  
## [13] "BeeNumCol"    "accFile"      "trialNum"     "datetime_str"
## [17] "lowFrq"       "highFrq"      "IT"           "trt"         
## [21] "amp_acc"
sl <- sl %>%
  # gets rid of the copious warnings
  mutate(timeSinceStart = NA, timeSinceLastBuzz = NA, buzzesSinceReward = NA) %>%
  # make sure all bee colors are lowercase
  mutate(beeCol =  tolower(beeCol)) %>%

  # fix orange.5, which should be orange.3
  mutate(hive = ifelse(hive == "5" & beeCol == "orange", "3", hive)) %>%
  # color + hive is an ID var
  mutate(beeColHive = interaction(beeCol, hive),
         colNum = paste(beeCol, hive, sep = "_")) %>%
  # remove two trials I messed up
  filter(!(beeCol == "whitepink" & trialNum == 3)) %>%
  filter(!(beeCol == "limepurple" & trialNum == 3)) %>%


  # convert hive to factor
  mutate(hive = as.factor(hive),
         trt2  = ifelse(trt == 'full' & trialNum > 1,
                        "full_2", as.character(trt)),
         trt = relevel(factor(trt), ref = "full")) %>%
  # divide amplitud by 2
  mutate(amp_acc2 = amp_acc / 2) %>%
  mutate(trialNum0 = trialNum - 1)



# interaction model
nrow(sl)
## [1] 24176
# note log-transformation to make model fit assumptions better
maa0 = lmer(log(amp_acc2) ~ trt* IT_imputed + hive + trialNum  + (1+trialNum|beeColHive), data = sl, REML = FALSE)

# main effect model
maa1 = lmer(log(amp_acc2) ~ trt+ IT_imputed + hive + trialNum  +(1+trialNum|beeColHive), data = sl, REML = FALSE)
BIC(maa0, maa1) # use no interaction (keep maa1)
##      df      BIC
## maa0 13 44127.96
## maa1 11 44119.14
anova(maa0, maa1) # note that this disagrees with likelihood ratio test
## Data: sl
## Models:
## maa1: log(amp_acc2) ~ trt + IT_imputed + hive + trialNum + (1 + trialNum | 
## maa1:     beeColHive)
## maa0: log(amp_acc2) ~ trt * IT_imputed + hive + trialNum + (1 + trialNum | 
## maa0:     beeColHive)
##      Df   AIC   BIC logLik deviance  Chisq Chi Df Pr(>Chisq)   
## maa1 11 44030 44119 -22004    44008                            
## maa0 13 44023 44128 -21998    43997 11.367      2   0.003402 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maa2 = update(maa1, .~. - trt)
BIC(maa1, maa2) # keep treatment (maa1)
##      df      BIC
## maa1 11 44119.14
## maa2  9 44124.30
anova(maa1, maa2) # agrees with LRT; p-val for paper, if needed
## Data: sl
## Models:
## maa2: log(amp_acc2) ~ IT_imputed + hive + trialNum + (1 + trialNum | 
## maa2:     beeColHive)
## maa1: log(amp_acc2) ~ trt + IT_imputed + hive + trialNum + (1 + trialNum | 
## maa1:     beeColHive)
##      Df   AIC   BIC logLik deviance  Chisq Chi Df Pr(>Chisq)    
## maa2  9 44051 44124 -22017    44033                             
## maa1 11 44030 44119 -22004    44008 25.342      2  3.141e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
maa3 <- update(maa1, .~. - hive)
BIC(maa1, maa3) # remove hive (maa3)
##      df      BIC
## maa1 11 44119.14
## maa3  9 44104.53
anova(maa1, maa3) # disagrees with LRT
## Data: sl
## Models:
## maa3: log(amp_acc2) ~ trt + IT_imputed + trialNum + (1 + trialNum | 
## maa3:     beeColHive)
## maa1: log(amp_acc2) ~ trt + IT_imputed + hive + trialNum + (1 + trialNum | 
## maa1:     beeColHive)
##      Df   AIC   BIC logLik deviance  Chisq Chi Df Pr(>Chisq)  
## maa3  9 44032 44105 -22007    44014                           
## maa1 11 44030 44119 -22004    44008 5.5751      2    0.06157 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(maa3)
## Linear mixed model fit by maximum likelihood  ['lmerMod']
## Formula: log(amp_acc2) ~ trt + IT_imputed + trialNum + (1 + trialNum |  
##     beeColHive)
##    Data: sl
## 
##      AIC      BIC   logLik deviance df.resid 
##  44031.7  44104.5 -22006.8  44013.7    24167 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.8379 -0.5956  0.1148  0.7380  2.8936 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev. Corr 
##  beeColHive (Intercept) 0.065569 0.25606       
##             trialNum    0.001557 0.03946  -0.59
##  Residual               0.358637 0.59886       
## Number of obs: 24176, groups:  beeColHive, 42
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept) 1.769408   0.440106   4.020
## trthigh     0.181341   0.036211   5.008
## trtlow      0.043373   0.030484   1.423
## IT_imputed  0.308792   0.106513   2.899
## trialNum    0.008597   0.008989   0.956
## 
## Correlation of Fixed Effects:
##            (Intr) trthgh trtlow IT_mpt
## trthigh     0.122                     
## trtlow     -0.032  0.040              
## IT_imputed -0.995 -0.129  0.023       
## trialNum    0.050 -0.105 -0.126 -0.100
## tt



m13 <- update(maa3, .~. - IT_imputed)
anova(maa3, m13) # remove IT, according to BIC
## Data: sl
## Models:
## m13: log(amp_acc2) ~ trt + trialNum + (1 + trialNum | beeColHive)
## maa3: log(amp_acc2) ~ trt + IT_imputed + trialNum + (1 + trialNum | 
## maa3:     beeColHive)
##      Df   AIC   BIC logLik deviance  Chisq Chi Df Pr(>Chisq)   
## m13   8 44037 44102 -22011    44021                            
## maa3  9 44032 44105 -22007    44014 7.7891      1   0.005256 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# refit with REML = TRUE for paper
m13 <- update(m13, .~., REML = TRUE)
summary(m13)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(amp_acc2) ~ trt + trialNum + (1 + trialNum | beeColHive)
##    Data: sl
## 
## REML criterion at convergence: 44043.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -4.8402 -0.5958  0.1147  0.7375  2.9643 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev. Corr 
##  beeColHive (Intercept) 0.077997 0.2793        
##             trialNum    0.001648 0.0406   -0.54
##  Residual               0.358670 0.5989        
## Number of obs: 24176, groups:  beeColHive, 42
## 
## Fixed effects:
##             Estimate Std. Error t value
## (Intercept) 3.039085   0.046419  65.471
## trthigh     0.194605   0.036375   5.350
## trtlow      0.040613   0.030872   1.316
## trialNum    0.009445   0.009264   1.020
## 
## Correlation of Fixed Effects:
##          (Intr) trthgh trtlow
## trthigh  -0.064              
## trtlow   -0.088  0.035       
## trialNum -0.478 -0.112 -0.117
# diagnostics
plot(m13)

qqnorm(ranef(m13)$beeColHive[[1]])
qqline(ranef(m13)$beeColHive[[1]])

plot_model(m13, type = "re") # plot random effects to find any outliers

plot_model(m13) # plot fixed effects
## Computing p-values via Wald-statistics approximation (treating t as Wald z).

# post-hoc tests -- pvals for paper
summary(glht(m13, linfct = mcp(trt = "Tukey")), test = adjusted("none"))
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Multiple Comparisons of Means: Tukey Contrasts
## 
## 
## Fit: lmer(formula = log(amp_acc2) ~ trt + trialNum + (1 + trialNum | 
##     beeColHive), data = sl, REML = TRUE)
## 
## Linear Hypotheses:
##                  Estimate Std. Error z value Pr(>|z|)    
## high - full == 0  0.19461    0.03638   5.350  8.8e-08 ***
## low - full == 0   0.04061    0.03087   1.316  0.18833    
## low - high == 0  -0.15399    0.04688  -3.285  0.00102 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- none method)
# post-hoc tests with bonf adjustment
summary(glht(m13, linfct = mcp(trt = "Tukey")), test = adjusted("bonf"))
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Multiple Comparisons of Means: Tukey Contrasts
## 
## 
## Fit: lmer(formula = log(amp_acc2) ~ trt + trialNum + (1 + trialNum | 
##     beeColHive), data = sl, REML = TRUE)
## 
## Linear Hypotheses:
##                  Estimate Std. Error z value Pr(>|z|)    
## high - full == 0  0.19461    0.03638   5.350 2.64e-07 ***
## low - full == 0   0.04061    0.03087   1.316  0.56499    
## low - high == 0  -0.15399    0.04688  -3.285  0.00306 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- bonferroni method)

Generate CI’s for acceleration

# # set number of bootstrap samples
# nbootSims2 = 1000
# 
# sl$trt
# 
# # don't need to include hive, but will set trialNum to 2
# pframe <- data.frame(trt = levels((sl$trt)), 
#                      IT_imputed = ITmean,  colNum = 99999, trialNum = 2)
# pframe$amp_acc <- 0
# # exponentiate to get back to original scale
# pp <- exp(predict(m13, newdata = pframe, re.form=NA, type = 'response')) # re.form sets all random effects to 0
# 
# 
# ### Calculate CI's (using bootstrap, not accounting for random effects)
# system.time({
#   bb2 <- bootMer(m13, FUN=function(x) predict(x, pframe, re.form=NA, type = 'response'), nsim = nbootSims2)
# })
# 
# print(paste("Number of bootstrap samples", nrow(bb2$t)))
# bb2_se <-apply(bb2$t,2,function(x) quantile(x, probs = c(0.025, 0.975)))
# 
# #exponentiate to get back to orignal scale
# pframe$blo<-exp(bb2_se[1,])
# pframe$bhi<-exp(bb2_se[2,])
# pframe$predMean <- pp
# pframe <- pframe[, c('trt', "blo", "bhi", "predMean")]
# pframe

Make plots for acceleration for paper

# #plot 95% confidence intervals
# # "Mean and bootstrap CI based on fixed-effects uncertainty ONLY"
# pframe$trt3 = plyr::mapvalues(pframe$trt, from = c("full", "high", "low"), 
#                         to = c("Full range\n(220 - 450 Hz)", "High range\n(340 - 390 Hz)", "Low range\n(220 - 330 Hz)"))
# 
# pframe
# ga0 <- ggplot(pframe, aes(x=trt3, y=predMean))+
#      geom_point()+ 
#      labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Frequency range for reward") + 
#      geom_errorbar(aes(ymin = blo, ymax = bhi), width = 0.1)+
#      theme(axis.text.x = element_text(angle = 45, hjust = 1), 
#            legend.position = 'none') +
#      theme_classic() + 
#   annotate(geom="text", x=c(1,2,3), y=c(0, 0, 0) + 58/2, label=c("a", "b", "a"),
#                 color="black") 
# ga0
# ggsave(plot = ga0, filename = file.path(figDir, "SonicationAmpPredsAndCI_unadjusted.svg"), width = 5, height = 4)
# 
# 
# # make plot using bonferroni adjustments
# 
# ga0 <- ggplot(pframe, aes(x=trt, y=predMean))+
#      geom_point()+ 
#      labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Frequency range for reward") + 
#      geom_errorbar(aes(ymin = blo, ymax = bhi), width = 0.1)+
#      theme(axis.text.x = element_text(angle = 45, hjust = 1), 
#            legend.position = 'none') +
#      theme_classic() + 
#   annotate(geom="text", x=c(1,2,3), y=c(0, 0, 0) + 58/2, label=c("a", "b", "a"),
#                 color="black") 
# ga0
# ggsave(plot = ga0, filename = file.path(figDir, "SonicationAmpPredsAndCI_BonfAdjusted.svg"), width = 5, height = 4)

Make acceleration plot the same as the frequency plot

# nbootSims = 10


# don't need hive, because that's not in the model we chose (above)
pframe_a <- data.frame(expand.grid(trt = levels(sl$trt), 
                                 IT_imputed = seq(min(s2$IT_imputed), max(s2$IT_imputed), 
                                                  length.out = 50),  
                                 beeColHive  = 99999, 
                                 trialNum = 2))
pframe_a$acc <- 0

pp <- predict(maa3, newdata = pframe_a, re.form=NA, type = 'response') %>% exp() # re.form sets all random effects to 0




### Calculate CI's (using bootstrap, not accounting for random effects)
system.time({
  bb2 <- bootMer(maa3, FUN=function(x) predict(x, pframe_a, re.form=NA, type = 'response'), nsim = nbootSims) 
})
##    user  system elapsed 
## 570.701   8.189 740.749
print(paste("Number of bootstrap samples", nrow(bb2$t)))
## [1] "Number of bootstrap samples 1000"
bb2_se <-apply(bb2$t,2,function(x) quantile(x, probs = c(0.025, 0.975)))
pframe_a$blo<-bb2_se[1,] %>% exp()
pframe_a$bhi<-bb2_se[2,] %>% exp()
pframe_a$predMean <- pp
pframe_a <- pframe_a[, c('trt',"IT_imputed", "blo", "bhi", "predMean")]
pframe_a
##      trt IT_imputed      blo      bhi predMean
## 1   full   3.480000 14.92130 20.49092 17.48249
## 2   high   3.480000 17.52856 24.97131 20.95843
## 3    low   3.480000 15.47934 21.40973 18.25745
## 4   full   3.509796 15.17261 20.54514 17.64409
## 5   high   3.509796 17.82574 25.02496 21.15216
## 6    low   3.509796 15.71701 21.47049 18.42620
## 7   full   3.539592 15.39468 20.56141 17.80717
## 8   high   3.539592 18.09191 25.07171 21.34767
## 9    low   3.539592 15.94283 21.54610 18.59652
## 10  full   3.569388 15.62000 20.65418 17.97177
## 11  high   3.569388 18.39424 25.15343 21.54499
## 12   low   3.569388 16.20354 21.66524 18.76841
## 13  full   3.599184 15.83513 20.73491 18.13789
## 14  high   3.599184 18.66304 25.21563 21.74414
## 15   low   3.599184 16.43740 21.78468 18.94189
## 16  full   3.628980 16.04877 20.79714 18.30554
## 17  high   3.628980 18.91551 25.34512 21.94512
## 18   low   3.628980 16.65401 21.84460 19.11698
## 19  full   3.658776 16.28957 20.88669 18.47474
## 20  high   3.658776 19.16470 25.42224 22.14796
## 21   low   3.658776 16.91001 21.93835 19.29368
## 22  full   3.688571 16.51883 20.98596 18.64551
## 23  high   3.688571 19.41859 25.58659 22.35268
## 24   low   3.688571 17.17045 22.03329 19.47202
## 25  full   3.718367 16.74591 20.99225 18.81785
## 26  high   3.718367 19.73413 25.76232 22.55929
## 27   low   3.718367 17.41308 22.14498 19.65200
## 28  full   3.748163 17.00733 21.02231 18.99179
## 29  high   3.748163 20.02179 25.85800 22.76781
## 30   low   3.748163 17.65803 22.26792 19.83365
## 31  full   3.777959 17.29064 21.08060 19.16733
## 32  high   3.777959 20.26990 25.98432 22.97826
## 33   low   3.777959 17.88915 22.35715 20.01697
## 34  full   3.807755 17.54388 21.25211 19.34450
## 35  high   3.807755 20.54958 26.09108 23.19065
## 36   low   3.807755 18.12204 22.49211 20.20199
## 37  full   3.837551 17.80082 21.41256 19.52331
## 38  high   3.837551 20.82454 26.14029 23.40501
## 39   low   3.837551 18.36044 22.62477 20.38873
## 40  full   3.867347 18.07270 21.46685 19.70376
## 41  high   3.867347 21.05723 26.34821 23.62135
## 42   low   3.867347 18.61702 22.75929 20.57718
## 43  full   3.897143 18.27901 21.62321 19.88589
## 44  high   3.897143 21.31606 26.50560 23.83969
## 45   low   3.897143 18.86327 22.84761 20.76738
## 46  full   3.926939 18.47491 21.81165 20.06970
## 47  high   3.926939 21.57774 26.66368 24.06004
## 48   low   3.926939 19.10755 23.00944 20.95934
## 49  full   3.956735 18.72604 21.98491 20.25521
## 50  high   3.956735 21.84331 26.84828 24.28243
## 51   low   3.956735 19.34762 23.20365 21.15307
## 52  full   3.986531 18.89685 22.13445 20.44243
## 53  high   3.986531 22.08898 27.03069 24.50688
## 54   low   3.986531 19.58479 23.38868 21.34859
## 55  full   4.016327 19.09548 22.28627 20.63138
## 56  high   4.016327 22.32890 27.26157 24.73340
## 57   low   4.016327 19.78835 23.62484 21.54592
## 58  full   4.046122 19.28199 22.47553 20.82209
## 59  high   4.046122 22.55763 27.52937 24.96202
## 60   low   4.046122 19.99061 23.83992 21.74508
## 61  full   4.075918 19.47116 22.63902 21.01455
## 62  high   4.075918 22.79601 27.75349 25.19275
## 63   low   4.075918 20.18524 24.07557 21.94607
## 64  full   4.105714 19.66172 22.83738 21.20879
## 65  high   4.105714 23.03786 28.00207 25.42561
## 66   low   4.105714 20.34556 24.27381 22.14892
## 67  full   4.135510 19.86696 23.07407 21.40483
## 68  high   4.135510 23.20926 28.23438 25.66062
## 69   low   4.135510 20.58605 24.47266 22.35365
## 70  full   4.165306 20.06340 23.30164 21.60268
## 71  high   4.165306 23.38716 28.48427 25.89781
## 72   low   4.165306 20.76111 24.71351 22.56027
## 73  full   4.195102 20.22911 23.53131 21.80235
## 74  high   4.195102 23.53858 28.72998 26.13719
## 75   low   4.195102 20.93004 25.02961 22.76880
## 76  full   4.224898 20.37300 23.77193 22.00388
## 77  high   4.224898 23.80039 29.00964 26.37878
## 78   low   4.224898 21.06414 25.25948 22.97926
## 79  full   4.254694 20.51275 24.00149 22.20727
## 80  high   4.254694 23.96033 29.26724 26.62261
## 81   low   4.254694 21.20817 25.55257 23.19166
## 82  full   4.284490 20.68004 24.25923 22.41253
## 83  high   4.284490 24.17189 29.60224 26.86868
## 84   low   4.284490 21.36220 25.87880 23.40602
## 85  full   4.314286 20.79990 24.56828 22.61970
## 86  high   4.314286 24.37055 29.89195 27.11704
## 87   low   4.314286 21.47099 26.18437 23.62237
## 88  full   4.344082 20.91689 24.88270 22.82877
## 89  high   4.344082 24.61206 30.22787 27.36769
## 90   low   4.344082 21.60822 26.49320 23.84072
## 91  full   4.373878 21.05271 25.24620 23.03979
## 92  high   4.373878 24.80339 30.55329 27.62065
## 93   low   4.373878 21.76850 26.80660 24.06108
## 94  full   4.403673 21.16086 25.61546 23.25275
## 95  high   4.403673 24.99472 30.95177 27.87596
## 96   low   4.403673 21.88560 27.17496 24.28348
## 97  full   4.433469 21.26987 25.99771 23.46768
## 98  high   4.433469 25.03595 31.30776 28.13362
## 99   low   4.433469 22.02170 27.47493 24.50794
## 100 full   4.463265 21.37762 26.37888 23.68459
## 101 high   4.463265 25.19318 31.76450 28.39366
## 102  low   4.463265 22.16118 27.76816 24.73447
## 103 full   4.493061 21.48148 26.78362 23.90352
## 104 high   4.493061 25.36295 32.12684 28.65611
## 105  low   4.493061 22.30518 28.15961 24.96310
## 106 full   4.522857 21.56288 27.13191 24.12446
## 107 high   4.522857 25.46175 32.53351 28.92099
## 108  low   4.522857 22.41326 28.61608 25.19384
## 109 full   4.552653 21.67381 27.54884 24.34745
## 110 high   4.552653 25.55923 32.97136 29.18831
## 111  low   4.552653 22.50606 29.03582 25.42671
## 112 full   4.582449 21.75472 27.93020 24.57250
## 113 high   4.582449 25.73006 33.46356 29.45810
## 114  low   4.582449 22.58562 29.47746 25.66174
## 115 full   4.612245 21.88776 28.28517 24.79963
## 116 high   4.612245 25.92033 33.93648 29.73039
## 117  low   4.612245 22.70949 29.89766 25.89893
## 118 full   4.642041 21.96621 28.69729 25.02885
## 119 high   4.642041 26.04195 34.47191 30.00520
## 120  low   4.642041 22.84392 30.27747 26.13832
## 121 full   4.671837 22.08061 29.17373 25.26020
## 122 high   4.671837 26.19108 35.02290 30.28254
## 123  low   4.671837 22.95575 30.73833 26.37992
## 124 full   4.701633 22.15798 29.60170 25.49369
## 125 high   4.701633 26.30307 35.63409 30.56245
## 126  low   4.701633 23.07707 31.15723 26.62376
## 127 full   4.731429 22.26174 30.03044 25.72933
## 128 high   4.731429 26.39870 36.13582 30.84494
## 129  low   4.731429 23.14064 31.62547 26.86985
## 130 full   4.761224 22.35438 30.42155 25.96715
## 131 high   4.761224 26.43772 36.64869 31.13005
## 132  low   4.761224 23.21742 32.13508 27.11821
## 133 full   4.791020 22.45535 30.84092 26.20717
## 134 high   4.791020 26.52807 37.13539 31.41779
## 135  low   4.791020 23.28967 32.63173 27.36887
## 136 full   4.820816 22.50567 31.26549 26.44941
## 137 high   4.820816 26.64325 37.61637 31.70819
## 138  low   4.820816 23.35399 33.14178 27.62185
## 139 full   4.850612 22.59841 31.74805 26.69389
## 140 high   4.850612 26.76066 38.19087 32.00128
## 141  low   4.850612 23.44550 33.65951 27.87716
## 142 full   4.880408 22.64534 32.25759 26.94062
## 143 high   4.880408 26.87859 38.84060 32.29707
## 144  low   4.880408 23.55927 34.18596 28.13484
## 145 full   4.910204 22.73691 32.76710 27.18964
## 146 high   4.910204 26.99703 39.41824 32.59560
## 147  low   4.910204 23.64358 34.71535 28.39489
## 148 full   4.940000 22.80712 33.25456 27.44096
## 149 high   4.940000 27.15383 39.97824 32.89689
## 150  low   4.940000 23.76831 35.25751 28.65735
pframe_a$trt3 = plyr::mapvalues(pframe$trt, from = c("full", "high", "low"), 
                        to = c("Full range\n(220 - 450 Hz)", 
                               "High range\n(340 - 390 Hz)",
                               "Low range\n(220 - 330 Hz)"))
ga1 <- ggplot(pframe_a, aes(x=IT_imputed, y=predMean, color = trt3, fill = trt3))+
        geom_line()+
        labs(y = expression ("Sonication acceleration "(m~s^{-2})), x = "Intertegular span (mm)") + 
        geom_ribbon(aes(ymin = blo, ymax = bhi), alpha = 0.3, color = NA)+
        theme(plot.background = element_rect(fill = "transparent",colour = NA), 
            panel.background = element_rect(fill = "transparent",colour = NA), 
            legend.position =c(0.2, 0.82), 
            legend.background = element_rect(fill="transparent", colour = NA),
            strip.background = element_blank(),
            legend.title = element_text(size = 8),
            panel.spacing.x = unit(1, "lines"), 
           plot.margin = margin(c(0.2,0.51, 0.2, 0.2), unit = "cm")) +
        scale_color_viridis_d(name = "Frequency range\nfor reward", end = 0.7, option = "inferno") + 
        scale_fill_viridis_d(name = "Frequency range\nfor reward", end =0.7, option = 'inferno')
ga1

ggsave(plot = ga1, filename = file.path(figDir, "SonicationAmpPredsAndCI_unadjusted_overlap.png"), unit = "in", dpi = 500,
       width = 6.5/2, height = 2.5)

svg(file.path(figDir, "SonicationAmpPredsAndCI_unadjusted_overlap.svg"), width = 6.5/2, height = 4)
ga1
dev.off()
## quartz_off_screen 
##                 2

combine freq and amp plots into a single figure

# set ggplot theme
theme_set(theme_classic() + theme(axis.text=element_text(colour="black"), text=element_text(size=10)))

g2 <- g1 + 
  theme(legend.position = c(1.1,1.1), 
        legend.direction = "horizontal", 
        plot.margin = margin(c(1.5,0.51, 0.2, 0.2), unit = "cm"), 
        legend.title = element_text(size = 10), 
        legend.text = element_text(size = 10))

ga2 <- ga1 + 
  theme(legend.position = "none", 
        plot.margin = margin(c(1.5,0.51, 0.2, 0.2), unit = "cm"))


aa <- plot_grid(g2, ga2 )


aa

svg(file.path(figDir, "Exp1_AccAndFreq.svg"), width = 6.5, height = 4)
aa
dev.off()
## quartz_off_screen 
##                 2

Visualize aggregated data for acceleration

aggdata <- aggregate(sl$amp_acc, by=list(colNum = sl$colNum,trialNum =sl$trialNum, trt = sl$trt), FUN=mean, na.rm=TRUE)
colnames(aggdata)[colnames(aggdata) == "x"] = "amp"

aggdata_sd <- aggregate(sl$amp_acc, by=list(colNum = sl$colNum,trialNum =sl$trialNum, trt = sl$trt), FUN=sd, na.rm=TRUE)
colnames(aggdata_sd)[colnames(aggdata_sd) == "x"] = "amp_sd"

aggdata = merge(aggdata, aggdata_sd)
aggdata = aggdata[order(aggdata$colNum, aggdata$trialNum, decreasing = FALSE), ]
agg_sm = aggdata[aggdata$trialNum <= 2, ]
rownames(agg_sm) = 1:nrow(agg_sm)
agg_sm
##                colNum trialNum  trt      amp    amp_sd
## 1              blue_4        1 full 40.03641 27.005004
## 2              gold_3        1 full 32.58012 13.395404
## 3           goldred_4        1 full 27.49328  8.575236
## 4             green_4        1 full 44.14520 45.654277
## 5             green_4        2 full 19.19985 21.543257
## 6              lime_5        1 full 72.53866 33.940021
## 7          limeblue_5        1 full 49.20279 24.837998
## 8          limeblue_5        2 full 59.04592 36.444346
## 9          limegold_5        1 full 34.95839 26.390545
## 10        limegreen_5        1 full 52.56061 32.949195
## 11       limeorange_5        1 full 43.28056 22.966005
## 12       limeorange_5        2 full 50.75113 25.907474
## 13         limepink_5        1 full 49.57493 19.711454
## 14       limepurple_5        1 full 43.98249 22.702402
## 15       limepurple_5        2  low 39.95722 19.359774
## 16 limepurpleyellow_5        1 full 34.54496 17.151702
## 17          limered_5        1 full 42.27701 20.963674
## 18          limered_5        2  low 40.63711 20.895896
## 19       limesilver_5        1 full 26.24910  7.336471
## 20        limewhite_5        1 full 37.65233 22.862123
## 21        limewhite_5        2 full 40.91118 19.936507
## 22       limeyellow_5        1 full 43.51579 23.156058
## 23           orange_3        1 full 45.95001 22.588043
## 24       orangeblue_5        1 full 51.97426 23.301810
## 25      orangegreen_5        1 full 58.59866 33.410963
## 26       orangepink_5        1 full 50.98635 28.370137
## 27     orangepurple_5        1 full 34.53312 16.739467
## 28           purple_3        1 full 53.61466 21.935890
## 29          redblue_4        1 full 28.88506 11.312274
## 30          redblue_4        2 full 48.61796 25.277613
## 31         redgreen_5        1 full 78.72927 46.273733
## 32         redgreen_5        2 full 70.38830 47.080737
## 33          redpink_5        1 full 74.20294 37.536798
## 34          redpink_5        2  low 56.85081 31.951114
## 35        redpurple_5        1 full 58.06343 40.818616
## 36        redpurple_5        2 high 53.13637 26.813039
## 37           silver_5        1 full 46.34517 30.280907
## 38            white_4        1 full 47.76100 21.162920
## 39            white_4        2 full 46.45015 22.564532
## 40        whiteblue_5        1 full 66.11499 33.532056
## 41        whiteblue_5        2  low 67.00735 29.330027
## 42        whitegold_5        1 full 43.10847 26.148044
## 43        whitegold_5        2  low 45.20369 27.241996
## 44       whitegreen_4        1 full 38.87762 18.184245
## 45      whiteorange_5        1 full 61.63802 39.835205
## 46      whiteorange_5        2  low 45.85399 25.838373
## 47        whitepink_5        1 full 63.53760 35.030181
## 48        whitepink_5        2 high 80.19250 47.237615
## 49      whitepurple_5        1 full 47.77247 35.753931
## 50         whitered_5        1 full 48.37233 25.860700
## 51         whitered_5        2 high 74.79446 45.764818
## 52      whiteyellow_5        1 full 65.50425 32.808944
## 53      whiteyellow_5        2 full 56.00923 33.372943
## 54       yellowblue_5        1 full 52.45834 30.688932
## 55       yellowblue_5        2 high 79.36156 41.580725
## 56      yellowgreen_5        1 full 61.58710 33.835105
## 57      yellowgreen_5        2 full 79.18968 27.697874
## 58     yelloworange_5        1 full 73.32616 36.109449
## 59     yelloworange_5        2 high 54.48161 24.329362
## 60       yellowpink_5        1 full 52.74199 24.869065
## 61       yellowpink_5        2  low 57.76271 29.939244
## 62     yellowpurple_5        1 full 62.77375 29.437162
## 63     yellowpurple_5        2  low 68.98565 35.865129
## 64        yellowred_5        1 full 62.77866 39.753892
## 65        yellowred_5        2 full 47.97187 28.376661
agg_sm[duplicated(data.frame(agg_sm$colNum, agg_sm$trialNum)), ]
## [1] colNum   trialNum trt      amp      amp_sd  
## <0 rows> (or 0-length row.names)
ggplot(agg_sm, aes(x = trt, y = amp, fill = trialNum > 1)) +
  geom_boxplot(alpha = 0.2) + 
  geom_point(aes(color = trialNum>1)) + 
  geom_line(aes(group = colNum))

diffdf <- sapply(unique(agg_sm$colNum), FUN = function(x){
  tmp = agg_sm[agg_sm$colNum == x, ]
  if(nrow(tmp) <= 1)
    diff = NA
  else
    diff = tmp$amp[tmp$trialNum == 2] - tmp$amp[tmp$trialNum == 1]
  return(diff)
})

trtDF = sapply(unique(agg_sm$colNum), FUN = function(x){
  tmp = agg_sm[agg_sm$colNum == x, ]
  ttrs = paste(tmp$trt[tmp$trialNum == 1], tmp$trt[tmp$trialNum == 2], sep = "_")
  return(ttrs)
})

buzzdiffs = data.frame(trtDF, diffdf)

ggplot(buzzdiffs, aes(x = trtDF, y= diffdf)) + 
  geom_boxplot() + 
  geom_point()+ 
  labs(y = "acceleration difference m/s/s")
## Warning: Removed 19 rows containing non-finite values (stat_boxplot).
## Warning: Removed 19 rows containing missing values (geom_point).

agg2 = aggregate(sl$amp_acc, by=list(colNum = sl$colNum, fullTrt = sl$trt == "full", trt = sl$trt), FUN=mean, na.rm=TRUE)
colnames(agg2)[colnames(agg2) == "x"] = "amp"
agg2$trt = as.character(agg2$trt)

diffdf <- t(as.data.frame(t(sapply(unique(agg2$colNum), FUN = function(x){
  tmp = agg2[agg2$colNum == x, ]
  if(nrow(tmp) <= 1)
    return(NA)
  if (length(unique(tmp$trt)) > 2){
    tmp = tmp[tmp$trt != "full_2", ]
  }
  diff =  tmp$amp[!tmp$fullTrt] - tmp$amp[tmp$fullTrt]
  return(diff)

}))))

length(diffdf)
## [1] 42
trtDF = sapply(unique(agg2$colNum), FUN = function(x){
  tmp = agg2[agg2$colNum == x, ]
  if (length(unique(tmp$trt)) > 2){
    tmp = tmp[tmp$trt != "full_2", ]
  }
  ttrs = paste(tmp$trt[tmp$fullTrt], tmp$trt[!tmp$fullTrt], sep = "_")
  return(ttrs)
})

length(trtDF)
## [1] 42
buzzdiffs = data.frame(trtDF, diffdf)
tapply(buzzdiffs$diffdf, INDEX = buzzdiffs$trtDF, mean)
##     full_ full_high  full_low 
##        NA  6.911151  3.249068
ggplot(droplevels(buzzdiffs[buzzdiffs$trtDF != "full_", ]), aes(x = trtDF, y= as.numeric(diffdf))) + 
  geom_boxplot() + 
  geom_point()+ 
  labs(y = "acceleration difference m/s/s")

Plot acceleration vs. frequency for initial trial, accounting for size

ggplot(sl[sl$trialNum == 1, ], aes(x = freq, y = amp_acc2)) + 
  geom_point(position = position_jitter(width = 1), alpha = 0.2) + 
  theme_classic() + 
  stat_smooth(aes(group = trt), method = "loess", se = TRUE, color = "grey40") + 
  labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Sonication Frequency (Hz)")

ggsave(filename = file.path(figDir, "FreqVAmp_t1.png"), width = 6, heigh = 4, dpi = 500, unit = "in")

ggplot(sl[sl$trialNum == 1, ], aes(x = freq, y = amp_acc2)) + 
  geom_point(position = position_jitter(width = 1), alpha = 0.2) + 
  theme_classic() + 
  facet_wrap(~beeColHive) + 
  stat_smooth(aes(group = trt), method = "loess", se = TRUE, color = "grey40") + 
  labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Sonication Frequency (Hz)")
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 329.65
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 60.35
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 7.3108e-17
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 414.12
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 329.65
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 60.35
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 7.3108e-17
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 414.12
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 369.7
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 50.3
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 106.09
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : span too small.
## fewer data values than degrees of freedom.
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 369.7
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 50.3
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 0
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 106.09
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 404.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)

ggsave(filename = file.path(figDir, "FreqVAmp_t1_facet.png"), width = 12, heigh = 12, dpi = 500, unit = "in")
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 329.65
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 60.35
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 7.3108e-17
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 414.12
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 329.65
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 60.35
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 7.3108e-17
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 414.12
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 369.7
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 50.3
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 106.09
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : span too small.
## fewer data values than degrees of freedom.
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : pseudoinverse used
## at 369.7
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : neighborhood radius
## 50.3
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : reciprocal
## condition number 0
## Warning in predLoess(object$y, object$x, newx = if
## (is.null(newdata)) object$x else if (is.data.frame(newdata))
## as.matrix(model.frame(delete.response(terms(object)), : There are other
## near singularities as well. 106.09
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 404.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
ggplot(sl, aes(x = freq, y = amp_acc2, color = trt)) + 
  geom_point(position = position_jitter(width = 1), alpha = 0.01, stroke = 0) + 
  theme_classic() + 
  facet_wrap(~beeColHive) + 
  stat_smooth(aes(color = trt, fill = trt, group = trt), method = "loess", se = FALSE) + 
  labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Sonication Frequency (Hz)")
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 329.65
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 60.35
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 7.3108e-17
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 414.12
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 369.7
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 50.3
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 106.09
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 404.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)

ggsave(filename = file.path(figDir, "FreqVAmp_t1_facet_trt.png"), width = 12, heigh = 12, dpi = 500, unit = "in")
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 329.65
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 60.35
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 7.3108e-17
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 414.12
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 369.7
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 50.3
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 0
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 106.09
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : span too small. fewer data values than degrees of freedom.
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at 299.9
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 404.01
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
mm1 <- lmer(log(amp_acc2) ~ I(scale(freq)) + I(scale(freq)^2) + I(scale(freq)^3) +
              I(scale(freq)^4) + (1|beeColHive), data = sl[sl$trialNum == 1, ])

mm2 <- lmer(log(amp_acc2) ~ I(scale(freq)) + I(scale(freq)^2) + I(scale(freq)^3)  + (1|beeColHive), data = sl[sl$trialNum == 1, ])

summary(mm2)
## Linear mixed model fit by REML ['lmerMod']
## Formula: 
## log(amp_acc2) ~ I(scale(freq)) + I(scale(freq)^2) + I(scale(freq)^3) +  
##     (1 | beeColHive)
##    Data: sl[sl$trialNum == 1, ]
## 
## REML criterion at convergence: 3533.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5406 -0.6267  0.0696  0.6804  2.4316 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  beeColHive (Intercept) 0.1014   0.3185  
##  Residual               0.3290   0.5736  
## Number of obs: 1971, groups:  beeColHive, 42
## 
## Fixed effects:
##                  Estimate Std. Error t value
## (Intercept)       3.10545    0.05320  58.374
## I(scale(freq))    0.36999    0.03008  12.299
## I(scale(freq)^2) -0.08814    0.01226  -7.188
## I(scale(freq)^3) -0.03919    0.01056  -3.711
## 
## Correlation of Fixed Effects:
##             (Intr) I(s()) I(()^2
## I(scl(frq)) -0.046              
## I(scl(f)^2) -0.241  0.079       
## I(scl(f)^3)  0.011 -0.846  0.065
plot(mm2)

plot(x = sl[sl$trialNum == 1, ]$freq, y = exp(predict(mm2, re.form =NA)))

ggplot(sl[sl$trialNum >= 2, ], aes(x = freq, y = amp_acc2)) + 
  geom_point(position = position_jitter(width = 1), alpha = 0.2, stroke = 0) + 
  theme_classic() + 
  facet_wrap(~trt, ncol = 1) + 
  stat_smooth(aes(color = trt), method = "loess", se = TRUE) + 
  labs( y = expression ("Sonication acceleration "(m~s^{-2})), x = "Sonication Frequency (Hz)") + 
  scale_color_viridis_d(name = "Treatment")

ggsave(filename = file.path(figDir, "FreqVAmp_allTrts.png"), width = 6, heigh = 4, dpi = 500, unit = "in")

centerFreq = scale(sl[sl$trialNum == 1, "freq"])

m1 <- lmer(log(amp_acc)~centerFreq + I(centerFreq^2) + I(centerFreq^3) + IT_imputed + (1|beeCol), data = sl[sl$trialNum == 1, ])
summary(m1)
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(amp_acc) ~ centerFreq + I(centerFreq^2) + I(centerFreq^3) +  
##     IT_imputed + (1 | beeCol)
##    Data: sl[sl$trialNum == 1, ]
## 
## REML criterion at convergence: 3526.4
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.5361 -0.6344  0.0693  0.6857  2.4239 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  beeCol   (Intercept) 0.08395  0.2897  
##  Residual             0.32877  0.5734  
## Number of obs: 1971, groups:  beeCol, 42
## 
## Fixed effects:
##                 Estimate Std. Error t value
## (Intercept)      2.00589    0.57016   3.518
## centerFreq       0.37124    0.03004  12.357
## I(centerFreq^2) -0.08590    0.01227  -7.003
## I(centerFreq^3) -0.03835    0.01055  -3.636
## IT_imputed       0.43530    0.13776   3.160
## 
## Correlation of Fixed Effects:
##             (Intr) cntrFr I(F^2) I(F^3)
## centerFreq  -0.047                     
## I(cntrFr^2) -0.093  0.081              
## I(cntrFr^3) -0.018 -0.844  0.065       
## IT_imputed  -0.996  0.043  0.071  0.019
plot(m1)

# predict -- using mean IT span
ppdf <- data.frame(centerFreq = sort(unique(centerFreq)), IT_imputed = ITmean, beeCol = 99999, acc_amp = 0)
# exponentiate to get back to original scale
ppdf$predAmp = exp(predict(m1, newdata = ppdf, type = "response", re.form = NA))



cf_Unscaled = ppdf$centerFreq * attr(centerFreq, 'scaled:scale') + attr(centerFreq, 'scaled:center')
ggplot(ppdf, aes(x = cf_Unscaled, y = predAmp))+ 
  geom_line() + 
  labs(x = "Sonication Frequency (Hz)", y = expression ("Sonication acceleration "(m~s^{-2})) ) + 
  geom_point(data = sl[sl$trialNum == 1, ], 
             aes(x = freq, y = amp_acc), 
             alpha = 0.2, position = position_jitter(width =2), pch =16, size = .5) 

ggsave(filename = file.path(figDir, "FreqVsAmp_1stTrial_rawData.svg"), width = 4, height = 3)

g22 <- ggplot(ppdf, aes(x = cf_Unscaled, y = predAmp))+ 
  geom_line() + 
  labs(x = "Sonication Frequency (Hz)", y = expression ("Predicted sonication acceleration "(m~s^{-2})) ) 
g22

ggsave(filename = file.path(figDir, "FreqVsAmp_1stTrial.svg"), width = 4, height = 3)
 

ggplot(sl, aes(x = trt2, y = IT_imputed)) + 
  geom_point()

analyze time between buzzes and num buzzes between rewards

# convert time to datetime format

# fresh dataset
sl <- read_csv(file.path(dataDir, '01_CombinedTrials_cleaned.csv'))

sl <- sl %>%
  mutate(beeColHive = interaction(beeCol, hive))


options(digits.secs=6)
sl$dateTime_fmt= as.POSIXct(strptime(x = sl$datetime_str, format = "%Y-%m-%d  %H:%M:%OS" ))

sl %>% head

sl$rewTF
colnames(sl)

# calculate time since beginning of trial
trialStart <- sl %>%
  # remove two trials I messed up
  filter(!(beeCol == "whitepink" & trialNum == 3)) %>%
  filter(!(beeCol == "limepurple" & trialNum == 3)) %>%
  
  dplyr::select(beeColHive, trialNum, dateTime_fmt) %>%
  filter(trialNum <= 10) %>%
  group_by(beeColHive, trialNum) %>%
  slice(1:1) %>%
  rename(trialStart = dateTime_fmt) %>%
  full_join(sl) %>%
  mutate(timeSinceStart = difftime(dateTime_fmt , trialStart, unit = 'sec')) %>%
  dplyr::select(beeColHive, trialNum, timeSinceStart, rewTF, dateTime_fmt, trt) %>%
  filter(rewTF == TRUE) %>%
  mutate(timeSinceReward = timeSinceStart - lag(timeSinceStart)) %>%
  arrange((dateTime_fmt)) %>%
  group_by(beeColHive) %>% mutate(index = row_number()) %>%
  filter(!is.na(timeSinceReward)) %>%
  #filter(timeSinceReward < 100000) %>%
  filter(beeColHive %in% .$beeColHive[.$trialNum > 1]) 

# note, use bb from above  
# bb <- trialStart %>%
#   dplyr::select(beeColHive, trt, trialNum) %>%
#   dplyr::filter(trialNum == 2 | trialNum == 3) %>%
#   group_by(beeColHive) %>% 
#   slice(1:1) %>%
#   dplyr::arrange(trt)
# 
# bb

trialStart <- trialStart %>%
  ungroup() %>%
  mutate(beeColHive = factor(beeColHive, levels = bb$beeColHive), 
       t5 = plyr::mapvalues(.$trt, from = c("full", "high", "low"), 
                        to = c("Full range\n(220 - 450 Hz)", 
                               "High range\n(340 - 390 Hz)", "Low range\n(220 - 330 Hz)"))) %>%
  filter(trialNum <= 10)

s44 <- trialStart %>%
 # filter(trialNum == 1) %>%
  group_by(beeColHive, trialNum, t5) %>%
  dplyr::summarise(meanInitialTime = mean((as.numeric(timeSinceReward))))

s44

ggplot(trialStart, aes(x = trialNum, y = as.numeric(timeSinceReward))) + 
  geom_point(alpha = 0.2, aes(color = t5, shape = t5)) + 
  facet_wrap(~beeColHive, ncol = 8) + 
  scale_color_viridis_d(name = "",
                        option = "magma", begin = 0.3,
                        end = 0.80, 
                        guide = guide_legend(override.aes = list(alpha = 1, size = 4))) + 
  scale_shape_manual(name = "", values = c(16,17,15)) + 
  #scale_y_log10() + 
  labs(x = "Trial Number", y = "Time between rewards (s)") + 
  theme_classic() + 
  theme(strip.background = element_blank(), 
        strip.text = element_blank(), 
        panel.border = element_rect(colour = "grey40", 
                                    fill=NA, size=0.5), 
        legend.position = 'top') + 
  # stat_smooth(method = 'loess', se = FALSE, aes(color = t5)) + 
  geom_hline(data = s44[s44$trialNum == 1,], aes(yintercept = as.numeric(meanInitialTime))) +
  
  geom_line(data = s44, aes(y = as.numeric(meanInitialTime), x = trialNum),lwd = 0.8, show.legend = FALSE) +
  geom_line(data = s44, aes(y = as.numeric(meanInitialTime), x = trialNum, color = t5), lwd = 0.8, show.legend = FALSE) +
  geom_point(data = s44, aes(y = as.numeric(meanInitialTime), x = trialNum), pch = 18) +
  scale_x_continuous(breaks = seq(2, 10, 2)) + 
  ylim(c(-1, 100))

ggsave(filename = file.path(figDir,"timeBWRewards.png"),
       dpi = 500,  width = 6.5*1.5, height = 4*1.5, units = "in")




timeSinceStart = list()
timeDiff = list()
timeSinceReward = list()
IDS = character()
prevRewardTime = NA
buzzesSinceReward = list()

# calculate num of buzzes since last reward
for(ii in 1:nrow(sl)){
  
  tmp = sl[ii, c("BeeNumCol", "dateTime_fmt", "rewTF", "index")]
  
  if(!(tmp$BeeNumCol %in% IDS)){
    timeSinceStart[ii] = difftime(tmp$dateTime_fmt, tmp$dateTime_fmt, units = "min")
    timeDiff[ii] = difftime(tmp$dateTime_fmt, tmp$dateTime_fmt, units = "min")
    timeSinceReward[ii] = difftime(tmp$dateTime_fmt, tmp$dateTime_fmt, units = "min")
    buzzesSinceReward[ii] = NA
    if(as.character(tmp$rewTF) == " T"){
      prevRewardTime = tmp$dateTime_fmt
      prevRewardBuzzNum = tmp$index
    }
    else{
       prevRewardTime = NA
       prevRewardBuzzNum = NA
    }
    startTime = tmp$dateTime_fmt
    IDS = append(IDS, as.character(tmp$BeeNumCol))
  }
  else{
    timeSinceStart[ii] = difftime(tmp$dateTime_fmt, startTime, units = "min")
    timeDiff[ii] = difftime(tmp$dateTime_fmt, prevTime, units = "min")
    
    timeSinceReward[ii] = difftime(tmp$dateTime_fmt, prevRewardTime, units = "min")
    buzzesSinceReward[ii] = tmp$index - prevRewardBuzzNum
    if(tmp$rewTF == " T"){
      prevRewardTime = tmp$dateTime_fmt
      prevRewardBuzzNum = tmp$index
    }
  }
  prevTime = tmp$dateTime_fmt

}


sl$timeSinceStart = unlist(timeSinceStart)
sl$timeSinceLastBuzz = unlist(timeDiff)
sl$timeSinceReward = unlist(timeSinceReward)
sl$buzzesSinceReward = unlist(buzzesSinceReward)

#plot(sl$index)
sl %>% head

plot(sl$timeSinceStart[1:500])
plot(sl$timeSinceLastBuzz[1:1000])

plot(na.omit(sl$buzzesSinceReward[1:5000]), xlim = c(0, 5000))

ggplot(data = sl[1:10000, ], mapping = aes(x = index, y = timeSinceReward, color= trt)) + 
# geom_boxplot() + 
   geom_point() + 
  facet_wrap(~trt) + 
  scale_y_log10() + 
  theme(legend.position = "none") + 
  geom_smooth(color = 'grey40') + 
  scale_color_viridis_d(option = "magma", end = 0.9)

ggplot(data = sl[1:10000, ], mapping = aes(x = index, y = timeSinceReward, color= trt)) + 
# geom_boxplot() + 
   geom_point() + 
  facet_wrap(~trt) + 
  scale_y_log10() + 
  theme(legend.position = "none") + 
  geom_smooth(color = 'grey40') + 
  scale_color_viridis_d(option = "magma", end = 0.9)



# plot time vs. reward 

ggplot(data = sl[1000:2000, ], mapping = aes(x = timeSinceStart, y = timeSinceReward, color= trt)) + 
# geom_boxplot() + 
   geom_point(alpha = 0.5) + 
  geom_line() + 
  facet_wrap(~BeeNumCol, scales = 'free') + 
  ylim(-0.1, 1.1) + 
  #geom_smooth() + 
  #theme(legend.position = "none") + 
  scale_color_viridis_d(option = "magma", end = 0.9, begin = 0.2,direction = -1)

# plot buzzes b/w rewards
ggplot(data = sl[grepl(pattern = "t", ignore.case = TRUE, x = sl$rewTF) & !(sl$trt %in% c("full", "full_2")), ][1:5000,], mapping = aes(x = index, y = buzzesSinceReward, color= trt)) + 
# geom_boxplot() + 
   geom_point(alpha = 0.5) + 
  geom_line() + 
  facet_wrap(~BeeNumCol, scales = 'free_x') + 
  #ylim(-0.1, 1.1) + 
  #geom_smooth() + 
  #theme(legend.position = "none") + 
  scale_color_viridis_d(option = "magma", end = 0.9, begin = 0.2,direction = -1)




unique(sl[1000:5000, ]$BeeNumCol)

# View(sl[sl$BeeNumCol == "Beelimered11_16Dec2016_Hive5_low", ])
# View(sl[grepl(pattern = "redpink1", x = as.character(sl$BeeNumCol)), ])
ggplot(data = sl[sl$BeeNumCol == "Beelimered11_16Dec2016_Hive5_low", ], mapping = aes(x = index, y = buzzesSinceReward, color= trt)) + 
# geom_boxplot() + 
   geom_point(alpha = 0.5) + 
  geom_line() + 
  facet_wrap(~BeeNumCol, scales = 'free') + 
  #ylim(-0.1, 1.1) + 
  #geom_smooth() + 
  #theme(legend.position = "none") + 
  scale_color_viridis_d(option = "magma", end = 0.9, begin = 0.2,direction = -1)


ggplot(data = sl[grepl(pattern = "redpink", x = as.character(sl$BeeNumCol)), ], mapping = aes(x = index, y = buzzesSinceReward, color= trt)) + 
# geom_boxplot() + 
   geom_point(alpha = 0.5) + 
  geom_line() + 
  facet_wrap(~BeeNumCol, scales = 'free') + 
  #ylim(-0.1, 1.1) + 
  #geom_smooth() + 
  #theme(legend.position = "none") + 
  scale_color_viridis_d(option = "magma", end = 0.9, begin = 0.2,direction = -1)

ggplot(sl[, ], aes(x = index, y = grepl("t", x = rewTF, ignore.case = TRUE)*1)) +
   geom_point() + 
  geom_smooth() + 
facet_wrap(~trt, scales = 'free')

binomial_smooth <- function(...){
  geom_smooth(method = "glm", method.args = list(family = "binomial"), ...)
}


ggplot(sl[, ], aes(x = timeSinceStart, y = grepl("t", x = rewTF, ignore.case = TRUE)*1)) +
   geom_point() + 
  binomial_smooth() +  
facet_wrap(~trt, scales = 'free')

ggplot(sl[sl$trt2 %in% c("low", "high"), ], aes(x = index, y = grepl("t", x = rewTF, ignore.case = TRUE)*1)) +
   geom_point() + 
  binomial_smooth(aes(color = as.factor(trialNum)), se = FALSE) +  
facet_wrap(~interaction(beeCol , hive, trt), scales = 'free') + 
  scale_color_viridis_d(end = 0.9, option = "magma", direction = -1)

# refref: visualize using overall buzz number (not reset for each trial), but still
# color by trial

IDS = character()
sl <- sl[order(sl$dateTime_fmt), ]
ID1 = interaction(sl$beeCol, sl$hive, sl$trt2)
buzzctr = 0
overallBuzz = numeric(length = nrow(sl))
for(ii in 1:nrow(sl)){
    tmp = ID1[ii]
    if(tmp %in% IDS){
      buzzctr =  max(overallBuzz[ID1 == tmp]) + 1
    }
    else{
      buzzctr = 0
      IDS = append(IDS, as.character(tmp))
    }
    overallBuzz[ii] = buzzctr
    print(ii)
}
sl$overallBuzz = overallBuzz
    
ggplot(sl[sl$trt2 != "full", ], aes(x = overallBuzz, 
                   y = grepl("t", x = rewTF, ignore.case = TRUE)*1, 
                   color = interaction(beeCol, hive, trt2, trialNum))) +
   geom_point() + 
  geom_smooth(se = FALSE) +  
  theme(legend.position = "none") + 
facet_wrap(~interaction(beeCol, hive, trt2), scales = 'free')




ggplot(sl[sl$trt2 != "full", ], aes(x = overallBuzz, 
                   y = freq, 
                   color = grepl("t", x = rewTF, ignore.case = TRUE))) +
   geom_point() + 
  stat_smooth(method = "loess", se = FALSE, color = "grey40", span = 0.9, lwd= 5) +  
  #theme(legend.position = "none") + 
facet_wrap(~interaction(beeCol, hive, trt2), scales = 'free') + 
  scale_color_viridis_d(name = "Reward")


ggplot(sl[sl$trt2 != "full", ], aes(x = overallBuzz, 
                   y = freq)) +
  geom_ribbon(aes(ymin=lowFrq,ymax=highFrq), fill="grey10", alpha= 0.9, color = NA) +
   geom_hex(binwidth = c(150, 10)) + 
  
  #theme(legend.position = "none") + 
facet_wrap(interaction(beeCol, hive, trt2)~., ncol = 6) + 
  scale_fill_viridis_c(name = "Num buzzes") + 
  geom_hline(aes(yintercept = lowFrq), color = 'grey40', size = 1, lty = 2) + 
  geom_hline(aes(yintercept = highFrq), color = 'grey40', size = 1, lty = 2) 
  


# refref calculate time differences b/w rewards
ggplot(sl[grepl(pattern = "t", x = as.character(sl$rewTF), ignore.case = TRUE) & sl$trt != "full", ], aes(x = as.factor(trialNum), y = timeSinceReward)) + 
         geom_point(aes(color= as.factor(trialNum))) + 
  facet_wrap(interaction(beeCol, hive, trt2)~., ncol = 6, scales = 'free_x') +
  ylim(c(0,1))


# num buzzes b/w rewards
ggplot(sl[grepl(pattern = "t", x = as.character(sl$rewTF), ignore.case = TRUE) & sl$trt2 != "full", ], aes(x = overallBuzz, y = buzzesSinceReward)) + 
         geom_point() + 
  facet_wrap(interaction(beeCol, hive, trt2)~., ncol = 6)


# num buzzes b/w rewards
ggplot(sl[grepl(pattern = "t", x = as.character(sl$rewTF), ignore.case = TRUE) & sl$trt2 != "full", ], aes(x = interaction(index < 50, as.factor(trialNum)), y = buzzesSinceReward, fill = index < 50)) + 
         geom_boxplot() + 
  
  theme(axis.text.x = element_text(angle = 90)) + 
  facet_wrap(interaction(beeCol, hive, trt2)~., ncol = 6, scales = 'free_x') + 
  scale_color_viridis_d()


#refref: calculate continuous time for each bee
sl$continuousTime = 0
sl$beeID = interaction(sl$beeCol, sl$hive)
jj = "orange.3"
kk = 1
for(jj in unique(sl$beeID)){
  tmp = sl[sl$beeID == jj, ]
  tmp %>% head()
  # sort
  tmp <- tmp[order(tmp$dateTime_fmt), ]
  
  times = numeric()
  trials = numeric()
  kk = 1
  for(kk in 1:nrow(tmp)){
    if(!(tmp$trialNum[kk] %in% trials)){
      trials <<- append(trials, tmp$trialNum[kk])
        if(kk == 1){
        times[kk] = 0
        }
      else{
        times[kk-1] = max(times)
      }
      
    }
    if(kk == 1){
        times[kk] = 0
        }
    else{
      times[kk] =  tmp$timeSinceLastBuzz[kk] + times[kk -1]
    }
  }
  tmp$continuousTime = times
  #plot(times)
  sl <- merge(sl, tmp, all = TRUE)
  
}

sl %>% head()



# proportion of rewarded buzzes over time
ggplot(sl, aes(x = timeSinceStart, y = grepl("t", x = rewTF, ignore.case = TRUE)* 1)) + 
  geom_point() + 
  theme(legend.position = "none") + 
  stat_smooth(method = "loess", aes(color = interaction(beeCol, hive, trt2, trialNum)), se = FALSE) + 
  facet_wrap(interaction(beeCol, hive, trt2)~., ncol = 6, scales = 'free_x') + 
  scale_color_viridis_d() + ylim(c(0, 1))
sessionInfo()
## R version 3.5.1 (2018-07-02)
## Platform: x86_64-apple-darwin15.6.0 (64-bit)
## Running under: macOS High Sierra 10.13.6
## 
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] gdtools_0.1.7   bindrcpp_0.2.2  cowplot_0.9.3   effects_4.0-3  
##  [5] carData_3.0-1   multcomp_1.4-8  TH.data_1.0-9   MASS_7.3-50    
##  [9] survival_2.42-6 mvtnorm_1.0-8   sjPlot_2.6.0    lme4_1.1-18-1  
## [13] Matrix_1.2-14   reshape2_1.4.3  forcats_0.3.0   stringr_1.3.1  
## [17] dplyr_0.7.6     purrr_0.2.5     readr_1.1.1     tidyr_0.8.1    
## [21] tibble_1.4.2    ggplot2_3.0.0   tidyverse_1.2.1
## 
## loaded via a namespace (and not attached):
##  [1] nlme_3.1-137       lubridate_1.7.4    RColorBrewer_1.1-2
##  [4] httr_1.3.1         rprojroot_1.3-2    tools_3.5.1       
##  [7] TMB_1.7.14         backports_1.1.2    utf8_1.1.4        
## [10] R6_2.2.2           sjlabelled_1.0.14  lazyeval_0.2.1    
## [13] colorspace_1.3-2   nnet_7.3-12        withr_2.1.2       
## [16] tidyselect_0.2.4   mnormt_1.5-5       emmeans_1.2.4     
## [19] compiler_3.5.1     cli_1.0.0          rvest_0.3.2       
## [22] xml2_1.2.0         sandwich_2.5-0     labeling_0.3      
## [25] scales_1.0.0       psych_1.8.4        ggridges_0.5.1    
## [28] digest_0.6.16      foreign_0.8-71     minqa_1.2.4       
## [31] svglite_1.2.1      rmarkdown_1.10     stringdist_0.9.5.1
## [34] pkgconfig_2.0.2    htmltools_0.3.6    pwr_1.2-2         
## [37] rlang_0.2.2        readxl_1.1.0       rstudioapi_0.7    
## [40] bindr_0.1.1        zoo_1.8-3          jsonlite_1.5      
## [43] magrittr_1.5       modeltools_0.2-22  bayesplot_1.6.0   
## [46] fansi_0.3.0        Rcpp_0.12.18       munsell_0.5.0     
## [49] prediction_0.3.6   stringi_1.2.4      yaml_2.2.0        
## [52] snakecase_0.9.2    plyr_1.8.4         grid_3.5.1        
## [55] parallel_3.5.1     sjmisc_2.7.5       crayon_1.3.4      
## [58] lattice_0.20-35    ggeffects_0.6.0    haven_1.1.2       
## [61] splines_3.5.1      sjstats_0.17.1     hms_0.4.2         
## [64] knitr_1.20         pillar_1.3.0       estimability_1.3  
## [67] codetools_0.2-15   stats4_3.5.1       glue_1.3.0        
## [70] evaluate_0.11      data.table_1.11.4  modelr_0.1.2      
## [73] nloptr_1.0.4       cellranger_1.1.0   gtable_0.2.0      
## [76] assertthat_0.2.0   coin_1.2-2         xtable_1.8-2      
## [79] broom_0.5.0        survey_3.33-2      coda_0.19-1       
## [82] viridisLite_0.3.0  glmmTMB_0.2.2.0